Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177431
b: refs/heads/master
c: c8829c7
h: refs/heads/master
i:
  177429: b51ac3a
  177427: f874305
  177423: 3826f34
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Dec 15, 2009
1 parent 60c9ce2 commit 1e45087
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f823e441ab4dfaeaf17832fa1931e0dc0fde304d
refs/heads/master: c8829c7a31c7e0156b230fa8d5a14be9881d7677
17 changes: 1 addition & 16 deletions trunk/tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,29 +521,14 @@ static const struct option options[] = {
OPT_END()
};

static void setup_sorting(void)
{
char *tmp, *tok, *str = strdup(sort_order);

for (tok = strtok_r(str, ", ", &tmp);
tok; tok = strtok_r(NULL, ", ", &tmp)) {
if (sort_dimension__add(tok) < 0) {
error("Unknown --sort key: `%s'", tok);
usage_with_options(annotate_usage, options);
}
}

free(str);
}

int cmd_annotate(int argc, const char **argv, const char *prefix __used)
{
if (symbol__init(&symbol_conf) < 0)
return -1;

argc = parse_options(argc, argv, options, annotate_usage, 0);

setup_sorting();
setup_sorting(annotate_usage, options);

if (argc) {
/*
Expand Down
17 changes: 1 addition & 16 deletions trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,21 +843,6 @@ static const struct option options[] = {
OPT_END()
};

static void setup_sorting(void)
{
char *tmp, *tok, *str = strdup(sort_order);

for (tok = strtok_r(str, ", ", &tmp);
tok; tok = strtok_r(NULL, ", ", &tmp)) {
if (sort_dimension__add(tok) < 0) {
error("Unknown --sort key: `%s'", tok);
usage_with_options(report_usage, options);
}
}

free(str);
}

static void setup_list(struct strlist **list, const char *list_str,
struct sort_entry *se, const char *list_name,
FILE *fp)
Expand All @@ -884,7 +869,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)

argc = parse_options(argc, argv, options, report_usage, 0);

setup_sorting();
setup_sorting(report_usage, options);

if (parent_pattern != default_parent_pattern) {
sort_dimension__add("parent");
Expand Down
15 changes: 15 additions & 0 deletions trunk/tools/perf/util/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,18 @@ int sort_dimension__add(const char *tok)

return -ESRCH;
}

void setup_sorting(const char * const usagestr[], const struct option *opts)
{
char *tmp, *tok, *str = strdup(sort_order);

for (tok = strtok_r(str, ", ", &tmp);
tok; tok = strtok_r(NULL, ", ", &tmp)) {
if (sort_dimension__add(tok) < 0) {
error("Unknown --sort key: `%s'", tok);
usage_with_options(usagestr, opts);
}
}

free(str);
}
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ struct sort_entry {
extern struct sort_entry sort_thread;
extern struct list_head hist_entry__sort_list;

void setup_sorting(const char * const usagestr[], const struct option *opts);

extern int repsep_fprintf(FILE *fp, const char *fmt, ...);
extern size_t sort__thread_print(FILE *, struct hist_entry *, unsigned int);
extern size_t sort__comm_print(FILE *, struct hist_entry *, unsigned int);
Expand Down

0 comments on commit 1e45087

Please sign in to comment.