62 inline void record_push() { ++_stats[push]; }
63 inline void record_pop() { ++_stats[pop]; }
64 inline void record_pop_slow() { record_pop(); ++_stats[pop_slow]; }
65 inline void record_steal(bool success);
66 inline void record_overflow(size_t new_length);
67
68 TaskQueueStats & operator +=(const TaskQueueStats & addend);
69
70 inline size_t get(StatId id) const { return _stats[id]; }
71 inline const size_t* get() const { return _stats; }
72
73 inline void reset();
74
75 // Print the specified line of the header (does not include a line separator).
76 static void print_header(unsigned int line, outputStream* const stream = tty,
77 unsigned int width = 10);
78 // Print the statistics (does not include a line separator).
79 void print(outputStream* const stream = tty, unsigned int width = 10) const;
80
81 DEBUG_ONLY(void verify() const;)
82
83 private:
84 size_t _stats[last_stat_id];
85 static const char * const _names[last_stat_id];
86 };
87
88 void TaskQueueStats::record_steal(bool success) {
89 ++_stats[steal_attempt];
90 if (success) ++_stats[steal];
91 }
92
93 void TaskQueueStats::record_overflow(size_t new_len) {
94 ++_stats[overflow];
95 if (new_len > _stats[overflow_max_len]) _stats[overflow_max_len] = new_len;
96 }
97
98 void TaskQueueStats::reset() {
99 memset(_stats, 0, sizeof(_stats));
100 }
101 #endif // TASKQUEUE_STATS
|
62 inline void record_push() { ++_stats[push]; }
63 inline void record_pop() { ++_stats[pop]; }
64 inline void record_pop_slow() { record_pop(); ++_stats[pop_slow]; }
65 inline void record_steal(bool success);
66 inline void record_overflow(size_t new_length);
67
68 TaskQueueStats & operator +=(const TaskQueueStats & addend);
69
70 inline size_t get(StatId id) const { return _stats[id]; }
71 inline const size_t* get() const { return _stats; }
72
73 inline void reset();
74
75 // Print the specified line of the header (does not include a line separator).
76 static void print_header(unsigned int line, outputStream* const stream = tty,
77 unsigned int width = 10);
78 // Print the statistics (does not include a line separator).
79 void print(outputStream* const stream = tty, unsigned int width = 10) const;
80
81 DEBUG_ONLY(void verify() const;)
82 DEBUG_ONLY(void verify_only_pushes() const;)
83
84 private:
85 size_t _stats[last_stat_id];
86 static const char * const _names[last_stat_id];
87 };
88
89 void TaskQueueStats::record_steal(bool success) {
90 ++_stats[steal_attempt];
91 if (success) ++_stats[steal];
92 }
93
94 void TaskQueueStats::record_overflow(size_t new_len) {
95 ++_stats[overflow];
96 if (new_len > _stats[overflow_max_len]) _stats[overflow_max_len] = new_len;
97 }
98
99 void TaskQueueStats::reset() {
100 memset(_stats, 0, sizeof(_stats));
101 }
102 #endif // TASKQUEUE_STATS
|