@@ -1175,6 +1175,8 @@ int cmd_report(int argc, const char **argv)
1175
1175
.annotation_opts = annotation__default_options ,
1176
1176
.skip_empty = true,
1177
1177
};
1178
+ char * sort_order_help = sort_help ("sort by key(s):" );
1179
+ char * field_order_help = sort_help ("output field(s): overhead period sample " );
1178
1180
const struct option options [] = {
1179
1181
OPT_STRING ('i' , "input" , & input_name , "file" ,
1180
1182
"input file name" ),
@@ -1209,9 +1211,9 @@ int cmd_report(int argc, const char **argv)
1209
1211
OPT_BOOLEAN (0 , "header-only" , & report .header_only ,
1210
1212
"Show only data header." ),
1211
1213
OPT_STRING ('s' , "sort" , & sort_order , "key[,key2...]" ,
1212
- sort_help ( "sort by key(s):" ) ),
1214
+ sort_order_help ),
1213
1215
OPT_STRING ('F' , "fields" , & field_order , "key[,keys...]" ,
1214
- sort_help ( "output field(s): overhead period sample " ) ),
1216
+ field_order_help ),
1215
1217
OPT_BOOLEAN (0 , "show-cpu-utilization" , & symbol_conf .show_cpu_utilization ,
1216
1218
"Show sample percentage for different cpu modes" ),
1217
1219
OPT_BOOLEAN_FLAG (0 , "showcpuutilization" , & symbol_conf .show_cpu_utilization ,
@@ -1344,11 +1346,11 @@ int cmd_report(int argc, const char **argv)
1344
1346
char sort_tmp [128 ];
1345
1347
1346
1348
if (ret < 0 )
1347
- return ret ;
1349
+ goto exit ;
1348
1350
1349
1351
ret = perf_config (report__config , & report );
1350
1352
if (ret )
1351
- return ret ;
1353
+ goto exit ;
1352
1354
1353
1355
argc = parse_options (argc , argv , options , report_usage , 0 );
1354
1356
if (argc ) {
@@ -1362,8 +1364,10 @@ int cmd_report(int argc, const char **argv)
1362
1364
report .symbol_filter_str = argv [0 ];
1363
1365
}
1364
1366
1365
- if (annotate_check_args (& report .annotation_opts ) < 0 )
1366
- return - EINVAL ;
1367
+ if (annotate_check_args (& report .annotation_opts ) < 0 ) {
1368
+ ret = - EINVAL ;
1369
+ goto exit ;
1370
+ }
1367
1371
1368
1372
if (report .mmaps_mode )
1369
1373
report .tasks_mode = true;
@@ -1377,12 +1381,14 @@ int cmd_report(int argc, const char **argv)
1377
1381
if (symbol_conf .vmlinux_name &&
1378
1382
access (symbol_conf .vmlinux_name , R_OK )) {
1379
1383
pr_err ("Invalid file: %s\n" , symbol_conf .vmlinux_name );
1380
- return - EINVAL ;
1384
+ ret = - EINVAL ;
1385
+ goto exit ;
1381
1386
}
1382
1387
if (symbol_conf .kallsyms_name &&
1383
1388
access (symbol_conf .kallsyms_name , R_OK )) {
1384
1389
pr_err ("Invalid file: %s\n" , symbol_conf .kallsyms_name );
1385
- return - EINVAL ;
1390
+ ret = - EINVAL ;
1391
+ goto exit ;
1386
1392
}
1387
1393
1388
1394
if (report .inverted_callchain )
@@ -1406,12 +1412,14 @@ int cmd_report(int argc, const char **argv)
1406
1412
1407
1413
repeat :
1408
1414
session = perf_session__new (& data , false, & report .tool );
1409
- if (IS_ERR (session ))
1410
- return PTR_ERR (session );
1415
+ if (IS_ERR (session )) {
1416
+ ret = PTR_ERR (session );
1417
+ goto exit ;
1418
+ }
1411
1419
1412
1420
ret = evswitch__init (& report .evswitch , session -> evlist , stderr );
1413
1421
if (ret )
1414
- return ret ;
1422
+ goto exit ;
1415
1423
1416
1424
if (zstd_init (& (session -> zstd_data ), 0 ) < 0 )
1417
1425
pr_warning ("Decompression initialization failed. Reported data may be incomplete.\n" );
@@ -1646,5 +1654,8 @@ int cmd_report(int argc, const char **argv)
1646
1654
1647
1655
zstd_fini (& (session -> zstd_data ));
1648
1656
perf_session__delete (session );
1657
+ exit :
1658
+ free (sort_order_help );
1659
+ free (field_order_help );
1649
1660
return ret ;
1650
1661
}
0 commit comments