You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cout << " -nsys | --nosystem | /nsys => hide system related output\n";
92
+
cout << " --color => use ASCII colors\n";
92
93
cout << " -csv[=file.csv] | /csv[=file.csv] => output compact CSV format to screen or\n"
93
94
<< " to a file, in case filename is provided\n"
94
95
<< " the format used is documented here: https://www.intel.com/content/www/us/en/developer/articles/technical/intel-pcm-column-names-decoder-ring.html\n";
@@ -169,10 +170,43 @@ void print_output(PCM * m,
169
170
constbool show_partial_core_output,
170
171
constbool show_socket_output,
171
172
constbool show_system_output,
172
-
constint metricVersion
173
+
constint metricVersion,
174
+
constbool color
173
175
)
174
176
{
175
177
cout << "\n";
178
+
auto setColor = [&color](constchar * colorStr)
179
+
{
180
+
return color ? colorStr : "";
181
+
};
182
+
std::vector<constchar *> colorTable = {
183
+
ASCII_GREEN,
184
+
ASCII_YELLOW,
185
+
ASCII_MAGENTA,
186
+
ASCII_CYAN,
187
+
ASCII_BRIGHT_GREEN,
188
+
ASCII_BRIGHT_YELLOW,
189
+
ASCII_BRIGHT_BLUE,
190
+
ASCII_BRIGHT_MAGENTA,
191
+
ASCII_BRIGHT_CYAN,
192
+
ASCII_BRIGHT_WHITE
193
+
};
194
+
size_t currentColor = 0;
195
+
auto setNextColor = [&setColor,¤tColor,colorTable]()
196
+
{
197
+
constauto result = setColor(colorTable[currentColor++]);
198
+
if (currentColor == colorTable.size())
199
+
{
200
+
currentColor = 0;
201
+
}
202
+
return result;
203
+
};
204
+
auto resetColor = [&setColor, ¤tColor]()
205
+
{
206
+
currentColor = 0;
207
+
returnsetColor(ASCII_RESET_COLOR);
208
+
};
209
+
176
210
switch (metricVersion)
177
211
{
178
212
case2:
@@ -1292,6 +1326,7 @@ int mainThrows(int argc, char * argv[])
1292
1326
bool disable_JKT_workaround = false; // as per http://software.intel.com/en-us/articles/performance-impact-when-sampling-certain-llc-events-on-snb-ep-with-vtune
1293
1327
bool enforceFlush = false;
1294
1328
int metricVersion = 2;
1329
+
bool color = false;
1295
1330
1296
1331
parsePID(argc, argv, pid);
1297
1332
@@ -1371,6 +1406,11 @@ int mainThrows(int argc, char * argv[])
0 commit comments