1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SRC_TRACED_PROBES_FTRACE_FTRACE_STATS_H_ 18 #define SRC_TRACED_PROBES_FTRACE_FTRACE_STATS_H_ 19 20 #include <inttypes.h> 21 22 #include <vector> 23 24 namespace perfetto { 25 26 namespace protos { 27 namespace pbzero { 28 class FtraceStats; 29 class FtraceCpuStats; 30 } // namespace pbzero 31 } // namespace protos 32 33 struct FtraceCpuStats { 34 uint64_t cpu; 35 uint64_t entries; 36 uint64_t overrun; 37 uint64_t commit_overrun; 38 uint64_t bytes_read; 39 double oldest_event_ts; 40 double now_ts; 41 uint64_t dropped_events; 42 uint64_t read_events; 43 44 void Write(protos::pbzero::FtraceCpuStats*) const; 45 }; 46 47 struct FtraceStats { 48 std::vector<FtraceCpuStats> cpu_stats; 49 uint32_t kernel_symbols_parsed = 0; 50 uint32_t kernel_symbols_mem_kb = 0; 51 52 void Write(protos::pbzero::FtraceStats*) const; 53 }; 54 55 } // namespace perfetto 56 57 #endif // SRC_TRACED_PROBES_FTRACE_FTRACE_STATS_H_ 58