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 #include "src/traced/probes/ftrace/ftrace_stats.h" 18 19 #include "protos/perfetto/trace/ftrace/ftrace_stats.pbzero.h" 20 21 namespace perfetto { 22 Write(protos::pbzero::FtraceStats * writer) const23void FtraceStats::Write(protos::pbzero::FtraceStats* writer) const { 24 for (const FtraceCpuStats& cpu_specific_stats : cpu_stats) { 25 cpu_specific_stats.Write(writer->add_cpu_stats()); 26 } 27 writer->set_kernel_symbols_parsed(kernel_symbols_parsed); 28 writer->set_kernel_symbols_mem_kb(kernel_symbols_mem_kb); 29 if (!setup_errors.atrace_errors.empty()) 30 writer->set_atrace_errors(setup_errors.atrace_errors); 31 for (const std::string& err : setup_errors.unknown_ftrace_events) 32 writer->add_unknown_ftrace_events(err); 33 for (const std::string& err : setup_errors.failed_ftrace_events) 34 writer->add_failed_ftrace_events(err); 35 } 36 Write(protos::pbzero::FtraceCpuStats * writer) const37void FtraceCpuStats::Write(protos::pbzero::FtraceCpuStats* writer) const { 38 writer->set_cpu(cpu); 39 writer->set_entries(entries); 40 writer->set_overrun(overrun); 41 writer->set_commit_overrun(commit_overrun); 42 writer->set_bytes_read(bytes_read); 43 writer->set_oldest_event_ts(oldest_event_ts); 44 writer->set_now_ts(now_ts); 45 writer->set_dropped_events(dropped_events); 46 writer->set_read_events(read_events); 47 } 48 49 } // namespace perfetto 50