aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-script.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 7732346bd9dd..4da5e32b9e03 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1262,6 +1262,18 @@ static struct {
1262 {0, NULL} 1262 {0, NULL}
1263}; 1263};
1264 1264
1265static const char *sample_flags_to_name(u32 flags)
1266{
1267 int i;
1268
1269 for (i = 0; sample_flags[i].name ; i++) {
1270 if (sample_flags[i].flags == flags)
1271 return sample_flags[i].name;
1272 }
1273
1274 return NULL;
1275}
1276
1265static int perf_sample__fprintf_flags(u32 flags, FILE *fp) 1277static int perf_sample__fprintf_flags(u32 flags, FILE *fp)
1266{ 1278{
1267 const char *chars = PERF_IP_FLAG_CHARS; 1279 const char *chars = PERF_IP_FLAG_CHARS;
@@ -1271,11 +1283,20 @@ static int perf_sample__fprintf_flags(u32 flags, FILE *fp)
1271 char str[33]; 1283 char str[33];
1272 int i, pos = 0; 1284 int i, pos = 0;
1273 1285
1274 for (i = 0; sample_flags[i].name ; i++) { 1286 name = sample_flags_to_name(flags & ~PERF_IP_FLAG_IN_TX);
1275 if (sample_flags[i].flags == (flags & ~PERF_IP_FLAG_IN_TX)) { 1287 if (name)
1276 name = sample_flags[i].name; 1288 return fprintf(fp, " %-15s%4s ", name, in_tx ? "(x)" : "");
1277 break; 1289
1278 } 1290 if (flags & PERF_IP_FLAG_TRACE_BEGIN) {
1291 name = sample_flags_to_name(flags & ~(PERF_IP_FLAG_IN_TX | PERF_IP_FLAG_TRACE_BEGIN));
1292 if (name)
1293 return fprintf(fp, " tr strt %-7s%4s ", name, in_tx ? "(x)" : "");
1294 }
1295
1296 if (flags & PERF_IP_FLAG_TRACE_END) {
1297 name = sample_flags_to_name(flags & ~(PERF_IP_FLAG_IN_TX | PERF_IP_FLAG_TRACE_END));
1298 if (name)
1299 return fprintf(fp, " tr end %-7s%4s ", name, in_tx ? "(x)" : "");
1279 } 1300 }
1280 1301
1281 for (i = 0; i < n; i++, flags >>= 1) { 1302 for (i = 0; i < n; i++, flags >>= 1) {
@@ -1288,10 +1309,7 @@ static int perf_sample__fprintf_flags(u32 flags, FILE *fp)
1288 } 1309 }
1289 str[pos] = 0; 1310 str[pos] = 0;
1290 1311
1291 if (name) 1312 return fprintf(fp, " %-19s ", str);
1292 return fprintf(fp, " %-7s%4s ", name, in_tx ? "(x)" : "");
1293
1294 return fprintf(fp, " %-11s ", str);
1295} 1313}
1296 1314
1297struct printer_data { 1315struct printer_data {