Loading tools/perf/Documentation/perf-list.txt +21 −2 Original line number Original line Diff line number Diff line Loading @@ -8,7 +8,7 @@ perf-list - List all symbolic event types SYNOPSIS SYNOPSIS -------- -------- [verse] [verse] 'perf list' 'perf list' [hw|sw|cache|tracepoint|event_glob] DESCRIPTION DESCRIPTION ----------- ----------- Loading Loading @@ -63,7 +63,26 @@ details. Some of them are referenced in the SEE ALSO section below. OPTIONS OPTIONS ------- ------- None Without options all known events will be listed. To limit the list use: . 'hw' or 'hardware' to list hardware events such as cache-misses, etc. . 'sw' or 'software' to list software events such as context switches, etc. . 'cache' or 'hwcache' to list hardware cache events such as L1-dcache-loads, etc. . 'tracepoint' to list all tracepoint events, alternatively use 'subsys_glob:event_glob' to filter by tracepoint subsystems such as sched, block, etc. . If none of the above is matched, it will apply the supplied glob to all events, printing the ones that match. One or more types can be used at the same time, listing the events for the types specified. SEE ALSO SEE ALSO -------- -------- Loading tools/perf/builtin-list.c +41 −2 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,7 @@ * * * Copyright (C) 2009, Thomas Gleixner <tglx@linutronix.de> * Copyright (C) 2009, Thomas Gleixner <tglx@linutronix.de> * Copyright (C) 2008-2009, Red Hat Inc, Ingo Molnar <mingo@redhat.com> * Copyright (C) 2008-2009, Red Hat Inc, Ingo Molnar <mingo@redhat.com> * Copyright (C) 2011, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> */ */ #include "builtin.h" #include "builtin.h" Loading @@ -13,9 +14,47 @@ #include "util/parse-events.h" #include "util/parse-events.h" #include "util/cache.h" #include "util/cache.h" int cmd_list(int argc __used, const char **argv __used, const char *prefix __used) int cmd_list(int argc, const char **argv, const char *prefix __used) { { setup_pager(); setup_pager(); print_events(); if (argc == 1) print_events(NULL); else { int i; for (i = 1; i < argc; ++i) { if (i > 1) putchar('\n'); if (strncmp(argv[i], "tracepoint", 10) == 0) print_tracepoint_events(NULL, NULL); else if (strcmp(argv[i], "hw") == 0 || strcmp(argv[i], "hardware") == 0) print_events_type(PERF_TYPE_HARDWARE); else if (strcmp(argv[i], "sw") == 0 || strcmp(argv[i], "software") == 0) print_events_type(PERF_TYPE_SOFTWARE); else if (strcmp(argv[i], "cache") == 0 || strcmp(argv[i], "hwcache") == 0) print_hwcache_events(NULL); else { char *sep = strchr(argv[i], ':'), *s; int sep_idx; if (sep == NULL) { print_events(argv[i]); continue; } sep_idx = sep - argv[i]; s = strdup(argv[i]); if (s == NULL) return -1; s[sep_idx] = '\0'; print_tracepoint_events(s, s + sep_idx + 1); free(s); } } } return 0; return 0; } } tools/perf/builtin-record.c +5 −5 Original line number Original line Diff line number Diff line Loading @@ -538,11 +538,6 @@ static int __cmd_record(int argc, const char **argv) if (have_tracepoints(&evsel_list->entries)) if (have_tracepoints(&evsel_list->entries)) perf_header__set_feat(&session->header, HEADER_TRACE_INFO); perf_header__set_feat(&session->header, HEADER_TRACE_INFO); /* * perf_session__delete(session) will be called at atexit_header() */ atexit(atexit_header); if (forks) { if (forks) { child_pid = fork(); child_pid = fork(); if (child_pid < 0) { if (child_pid < 0) { Loading Loading @@ -601,6 +596,11 @@ static int __cmd_record(int argc, const char **argv) perf_session__set_sample_type(session, sample_type); perf_session__set_sample_type(session, sample_type); /* * perf_session__delete(session) will be called at atexit_header() */ atexit(atexit_header); if (pipe_output) { if (pipe_output) { err = perf_header__write_pipe(output); err = perf_header__write_pipe(output); if (err < 0) if (err < 0) Loading tools/perf/builtin-report.c +6 −0 Original line number Original line Diff line number Diff line Loading @@ -350,6 +350,12 @@ static int __cmd_report(void) perf_session__fprintf_dsos(session, stdout); perf_session__fprintf_dsos(session, stdout); next = rb_first(&session->hists_tree); next = rb_first(&session->hists_tree); if (next == NULL) { ui__warning("The %s file has no samples!\n", input_name); goto out_delete; } while (next) { while (next) { struct hists *hists; struct hists *hists; Loading tools/perf/util/evsel.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,7 @@ void perf_evsel__delete(struct perf_evsel *evsel) { { perf_evsel__exit(evsel); perf_evsel__exit(evsel); close_cgroup(evsel->cgrp); close_cgroup(evsel->cgrp); free(evsel->name); free(evsel); free(evsel); } } Loading Loading
tools/perf/Documentation/perf-list.txt +21 −2 Original line number Original line Diff line number Diff line Loading @@ -8,7 +8,7 @@ perf-list - List all symbolic event types SYNOPSIS SYNOPSIS -------- -------- [verse] [verse] 'perf list' 'perf list' [hw|sw|cache|tracepoint|event_glob] DESCRIPTION DESCRIPTION ----------- ----------- Loading Loading @@ -63,7 +63,26 @@ details. Some of them are referenced in the SEE ALSO section below. OPTIONS OPTIONS ------- ------- None Without options all known events will be listed. To limit the list use: . 'hw' or 'hardware' to list hardware events such as cache-misses, etc. . 'sw' or 'software' to list software events such as context switches, etc. . 'cache' or 'hwcache' to list hardware cache events such as L1-dcache-loads, etc. . 'tracepoint' to list all tracepoint events, alternatively use 'subsys_glob:event_glob' to filter by tracepoint subsystems such as sched, block, etc. . If none of the above is matched, it will apply the supplied glob to all events, printing the ones that match. One or more types can be used at the same time, listing the events for the types specified. SEE ALSO SEE ALSO -------- -------- Loading
tools/perf/builtin-list.c +41 −2 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,7 @@ * * * Copyright (C) 2009, Thomas Gleixner <tglx@linutronix.de> * Copyright (C) 2009, Thomas Gleixner <tglx@linutronix.de> * Copyright (C) 2008-2009, Red Hat Inc, Ingo Molnar <mingo@redhat.com> * Copyright (C) 2008-2009, Red Hat Inc, Ingo Molnar <mingo@redhat.com> * Copyright (C) 2011, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> */ */ #include "builtin.h" #include "builtin.h" Loading @@ -13,9 +14,47 @@ #include "util/parse-events.h" #include "util/parse-events.h" #include "util/cache.h" #include "util/cache.h" int cmd_list(int argc __used, const char **argv __used, const char *prefix __used) int cmd_list(int argc, const char **argv, const char *prefix __used) { { setup_pager(); setup_pager(); print_events(); if (argc == 1) print_events(NULL); else { int i; for (i = 1; i < argc; ++i) { if (i > 1) putchar('\n'); if (strncmp(argv[i], "tracepoint", 10) == 0) print_tracepoint_events(NULL, NULL); else if (strcmp(argv[i], "hw") == 0 || strcmp(argv[i], "hardware") == 0) print_events_type(PERF_TYPE_HARDWARE); else if (strcmp(argv[i], "sw") == 0 || strcmp(argv[i], "software") == 0) print_events_type(PERF_TYPE_SOFTWARE); else if (strcmp(argv[i], "cache") == 0 || strcmp(argv[i], "hwcache") == 0) print_hwcache_events(NULL); else { char *sep = strchr(argv[i], ':'), *s; int sep_idx; if (sep == NULL) { print_events(argv[i]); continue; } sep_idx = sep - argv[i]; s = strdup(argv[i]); if (s == NULL) return -1; s[sep_idx] = '\0'; print_tracepoint_events(s, s + sep_idx + 1); free(s); } } } return 0; return 0; } }
tools/perf/builtin-record.c +5 −5 Original line number Original line Diff line number Diff line Loading @@ -538,11 +538,6 @@ static int __cmd_record(int argc, const char **argv) if (have_tracepoints(&evsel_list->entries)) if (have_tracepoints(&evsel_list->entries)) perf_header__set_feat(&session->header, HEADER_TRACE_INFO); perf_header__set_feat(&session->header, HEADER_TRACE_INFO); /* * perf_session__delete(session) will be called at atexit_header() */ atexit(atexit_header); if (forks) { if (forks) { child_pid = fork(); child_pid = fork(); if (child_pid < 0) { if (child_pid < 0) { Loading Loading @@ -601,6 +596,11 @@ static int __cmd_record(int argc, const char **argv) perf_session__set_sample_type(session, sample_type); perf_session__set_sample_type(session, sample_type); /* * perf_session__delete(session) will be called at atexit_header() */ atexit(atexit_header); if (pipe_output) { if (pipe_output) { err = perf_header__write_pipe(output); err = perf_header__write_pipe(output); if (err < 0) if (err < 0) Loading
tools/perf/builtin-report.c +6 −0 Original line number Original line Diff line number Diff line Loading @@ -350,6 +350,12 @@ static int __cmd_report(void) perf_session__fprintf_dsos(session, stdout); perf_session__fprintf_dsos(session, stdout); next = rb_first(&session->hists_tree); next = rb_first(&session->hists_tree); if (next == NULL) { ui__warning("The %s file has no samples!\n", input_name); goto out_delete; } while (next) { while (next) { struct hists *hists; struct hists *hists; Loading
tools/perf/util/evsel.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,7 @@ void perf_evsel__delete(struct perf_evsel *evsel) { { perf_evsel__exit(evsel); perf_evsel__exit(evsel); close_cgroup(evsel->cgrp); close_cgroup(evsel->cgrp); free(evsel->name); free(evsel); free(evsel); } } Loading