Intel(R) Threading Building Blocks Doxygen Documentation version 4.2.3
tbb_statistics.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2005-2020 Intel Corporation
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef _TBB_tbb_statistics_H
18#define _TBB_tbb_statistics_H
19
59#include "tbb/tbb_stddef.h"
60
61#ifndef __TBB_STATISTICS
62#define __TBB_STATISTICS 0
63#endif /* __TBB_STATISTICS */
64
65#if __TBB_STATISTICS
66
67#include <string.h> // for memset
68
70
71#define __TBB_STATISTICS_STDOUT 1
72
74
76#define __TBB_STATISTICS_TOTALS_ONLY 1
77
79
82#define __TBB_STATISTICS_EARLY_DUMP 1
83
84#define GATHER_STATISTIC(x) (x)
85
86namespace tbb {
87namespace internal {
88
90
92enum statistics_groups {
93 sg_task_allocation = 0x01,
94 sg_task_execution = 0x02,
95 sg_stealing = 0x04,
96 sg_affinity = 0x08,
97 sg_arena = 0x10,
98 sg_market = 0x20,
99 sg_prio = 0x40,
100 sg_prio_ex = 0x80,
101 // List end marker. Insert new groups only before it.
102 sg_end
103};
104
106const uintptr_t __TBB_ActiveStatisticsGroups = sg_task_execution | sg_stealing | sg_affinity | sg_arena | sg_market;
107
109
111struct statistics_counters {
112 typedef long counter_type;
113
114 // Group: sg_task_allocation
115 // Counters in this group can have negative values as the tasks migrate across
116 // threads while the associated counters are updated in the current thread only
117 // to avoid data races
118
120 counter_type active_tasks;
122 counter_type free_list_length;
124
125 counter_type big_tasks;
126
127 // Group: sg_task_execution
128
130 counter_type tasks_executed;
132 counter_type spawns_bypassed;
133
134 // Group: sg_stealing
135
137 counter_type steals_committed;
139 counter_type steals_failed;
141 counter_type thieves_conflicts;
143 counter_type thief_backoffs;
144
145 // Group: sg_affinity
146
148 counter_type mails_received;
150
151 counter_type proxies_executed;
153 counter_type proxies_stolen;
155 counter_type proxies_bypassed;
157 counter_type affinity_ignored;
158
159 // Group: sg_arena
160
162 counter_type gate_switches;
164 counter_type arena_roundtrips;
165 // !Average concurrency level of this arena
166 counter_type avg_arena_concurrency;
168 counter_type avg_assigned_workers;
169
170 // Group: sg_market
171
173 counter_type market_roundtrips;
174
175 // Group; sg_prio
176
178 counter_type arena_prio_switches;
180 counter_type market_prio_switches;
182 counter_type arena_prio_resets;
184 counter_type prio_ref_fixups;
186 counter_type avg_arena_prio;
188 counter_type avg_market_prio;
189
190 // Group; sg_prio_ex
191
193 counter_type prio_winnowings;
195 counter_type prio_reloads;
197 counter_type prio_orphanings;
199 counter_type prio_tasks_offloaded;
201 counter_type prio_tasks_reloaded;
202
203 // Constructor and helpers
204
205 statistics_counters() { reset(); }
206
207 void reset () { memset( this, 0, sizeof(statistics_counters) ); }
208
209 counter_type& field ( size_t index ) { return reinterpret_cast<counter_type*>(this)[index]; }
210
211 const counter_type& field ( size_t index ) const { return reinterpret_cast<const counter_type*>(this)[index]; }
212
213 static size_t size () { return sizeof(statistics_counters) / sizeof(counter_type); }
214
215 const statistics_counters& operator += ( const statistics_counters& rhs ) {
216 for ( size_t i = 0; i < size(); ++i )
217 field(i) += rhs.field(i);
218 return *this;
219 }
220}; // statistics_counters
221
222static const size_t workers_counters_total = (size_t)-1;
223static const size_t arena_counters_total = (size_t)-2;
224
225void dump_statistics ( const statistics_counters& c, size_t id );
226
227} // namespace internal
228} // namespace tbb
229
230#else /* !__TBB_STATISTICS */
231
232#define GATHER_STATISTIC(x) ((void)0)
233
234#endif /* !__TBB_STATISTICS */
235
236#endif /* _TBB_tbb_statistics_H */
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
The graph class.

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.