diff options
Diffstat (limited to 'protos/perfetto/common/perf_events.proto')
-rw-r--r-- | protos/perfetto/common/perf_events.proto | 81 |
1 files changed, 79 insertions, 2 deletions
diff --git a/protos/perfetto/common/perf_events.proto b/protos/perfetto/common/perf_events.proto index 77f3a1ebf..270bacb12 100644 --- a/protos/perfetto/common/perf_events.proto +++ b/protos/perfetto/common/perf_events.proto @@ -18,6 +18,7 @@ syntax = "proto2"; package perfetto.protos; +// Next id: 12 message PerfEvents { // What event to sample on, and how often. Commented from the perspective of // its use in |PerfEventConfig|. @@ -47,17 +48,72 @@ message PerfEvents { oneof event { Counter counter = 4; Tracepoint tracepoint = 3; + RawEvent raw_event = 5; } + + // If set, samples will be timestamped with the given clock. + // If unset, the clock is chosen by the implementation. + // For software events, prefer PERF_CLOCK_BOOTTIME. However it cannot be + // used for hardware events (due to interrupt safety), for which the + // recommendation is to use one of the monotonic clocks. + optional PerfClock timestamp_clock = 11; + + // Optional arbitrary name for the event, to identify it in the parsed + // trace. Does *not* affect the profiling itself. If unset, the trace + // parser will choose a suitable name. + optional string name = 10; } + // Builtin counter names from the uapi header. Commented with their perf tool + // aliases. + // TODO(rsavitski): consider generating enums for cache events (should be + // finite), and generally make this list as extensive as possible. Excluding + // things like dynamic PMUs since those don't fit into a static enum. + // Next id: 21 enum Counter { UNKNOWN_COUNTER = 0; - // software: + + // cpu-clock SW_CPU_CLOCK = 1; + // page-faults, faults SW_PAGE_FAULTS = 2; - // hardware: + // task-clock + SW_TASK_CLOCK = 3; + // context-switches, cs + SW_CONTEXT_SWITCHES = 4; + // cpu-migrations, migrations + SW_CPU_MIGRATIONS = 5; + // minor-faults + SW_PAGE_FAULTS_MIN = 6; + // major-faults + SW_PAGE_FAULTS_MAJ = 7; + // alignment-faults + SW_ALIGNMENT_FAULTS = 8; + // emulation-faults + SW_EMULATION_FAULTS = 9; + // dummy + SW_DUMMY = 20; + + // cpu-cycles, cycles HW_CPU_CYCLES = 10; + // instructions HW_INSTRUCTIONS = 11; + // cache-references + HW_CACHE_REFERENCES = 12; + // cache-misses + HW_CACHE_MISSES = 13; + // branch-instructions, branches + HW_BRANCH_INSTRUCTIONS = 14; + // branch-misses + HW_BRANCH_MISSES = 15; + // bus-cycles + HW_BUS_CYCLES = 16; + // stalled-cycles-frontend, idle-cycles-frontend + HW_STALLED_CYCLES_FRONTEND = 17; + // stalled-cycles-backend, idle-cycles-backend + HW_STALLED_CYCLES_BACKEND = 18; + // ref-cycles + HW_REF_CPU_CYCLES = 19; } message Tracepoint { @@ -73,4 +129,25 @@ message PerfEvents { // https://www.kernel.org/doc/Documentation/trace/events.txt optional string filter = 2; } + + // Syscall-level description of the event, propagated to the perf_event_attr + // struct. Primarily for local use-cases, since the event availability and + // encoding is hardware-specific. + message RawEvent { + optional uint32 type = 1; + optional uint64 config = 2; + optional uint64 config1 = 3; + optional uint64 config2 = 4; + } + + // Subset of clocks that is supported by perf timestamping. + // CLOCK_TAI is excluded since it's not expected to be used in practice, but + // would require additions to the trace clock synchronisation logic. + enum PerfClock { + UNKNOWN_PERF_CLOCK = 0; + PERF_CLOCK_REALTIME = 1; + PERF_CLOCK_MONOTONIC = 2; + PERF_CLOCK_MONOTONIC_RAW = 3; + PERF_CLOCK_BOOTTIME = 4; + } } |