perf config: Add stat.big-num support
Add support for new "stat.big-num" boolean option. This allows a user to set a default for "--no-big-num" for "perf stat" commands. -- $ perf config stat.big-num $ perf stat --event cycles /bin/true Performance counter stats for '/bin/true': 778,849 cycles [...] $ perf config stat.big-num=false $ perf config stat.big-num stat.big-num=false $ perf stat --event cycles /bin/true Performance counter stats for '/bin/true': 769622 cycles [...] -- There is an interaction with "--field-separator" that must be accommodated, such that specifying "--big-num --field-separator={x}" still reports an invalid combination of options. Documentation for perf-config and perf-stat updated. Signed-off-by: Paul Clarke <pc@us.ibm.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Link: http://lore.kernel.org/lkml/1589991815-17951-1-git-send-email-pc@us.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
04f9bf2bac
commit
d778a778a8
@@ -17,6 +17,7 @@
|
||||
#include "util/event.h" /* proc_map_timeout */
|
||||
#include "util/hist.h" /* perf_hist_config */
|
||||
#include "util/llvm-utils.h" /* perf_llvm_config */
|
||||
#include "util/stat.h" /* perf_stat__set_big_num */
|
||||
#include "build-id.h"
|
||||
#include "debug.h"
|
||||
#include "config.h"
|
||||
@@ -452,6 +453,15 @@ static int perf_ui_config(const char *var, const char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int perf_stat_config(const char *var, const char *value)
|
||||
{
|
||||
if (!strcmp(var, "stat.big-num"))
|
||||
perf_stat__set_big_num(perf_config_bool(var, value));
|
||||
|
||||
/* Add other config variables here. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int perf_default_config(const char *var, const char *value,
|
||||
void *dummy __maybe_unused)
|
||||
{
|
||||
@@ -473,6 +483,9 @@ int perf_default_config(const char *var, const char *value,
|
||||
if (strstarts(var, "buildid."))
|
||||
return perf_buildid_config(var, value);
|
||||
|
||||
if (strstarts(var, "stat."))
|
||||
return perf_stat_config(var, value);
|
||||
|
||||
/* Add other config variables here. */
|
||||
return 0;
|
||||
}
|
||||
|
@@ -133,6 +133,8 @@ struct perf_stat_config {
|
||||
struct rblist metric_events;
|
||||
};
|
||||
|
||||
void perf_stat__set_big_num(int set);
|
||||
|
||||
void update_stats(struct stats *stats, u64 val);
|
||||
double avg_stats(struct stats *stats);
|
||||
double stddev_stats(struct stats *stats);
|
||||
|
Reference in New Issue
Block a user