xref: /aosp_15_r20/external/perfetto/src/trace_processor/importers/ftrace/ftrace_parser.h (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1 /*
2  * Copyright (C) 2019 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_TRACE_PROCESSOR_IMPORTERS_FTRACE_FTRACE_PARSER_H_
18 #define SRC_TRACE_PROCESSOR_IMPORTERS_FTRACE_FTRACE_PARSER_H_
19 
20 #include <array>
21 #include <cstddef>
22 #include <cstdint>
23 #include <string>
24 #include <unordered_map>
25 #include <unordered_set>
26 #include <utility>
27 #include <vector>
28 
29 #include "perfetto/base/status.h"
30 #include "perfetto/ext/base/flat_hash_map.h"
31 #include "perfetto/ext/base/hash.h"
32 #include "perfetto/ext/base/string_view.h"
33 #include "perfetto/protozero/field.h"
34 #include "src/trace_processor/importers/common/event_tracker.h"
35 #include "src/trace_processor/importers/common/parser_types.h"
36 #include "src/trace_processor/importers/common/trace_parser.h"
37 #include "src/trace_processor/importers/ftrace/drm_tracker.h"
38 #include "src/trace_processor/importers/ftrace/ftrace_descriptors.h"
39 #include "src/trace_processor/importers/ftrace/gpu_work_period_tracker.h"
40 #include "src/trace_processor/importers/ftrace/iostat_tracker.h"
41 #include "src/trace_processor/importers/ftrace/mali_gpu_event_tracker.h"
42 #include "src/trace_processor/importers/ftrace/pixel_mm_kswapd_event_tracker.h"
43 #include "src/trace_processor/importers/ftrace/pkvm_hyp_cpu_tracker.h"
44 #include "src/trace_processor/importers/ftrace/rss_stat_tracker.h"
45 #include "src/trace_processor/importers/ftrace/thermal_tracker.h"
46 #include "src/trace_processor/importers/ftrace/virtio_gpu_tracker.h"
47 #include "src/trace_processor/storage/trace_storage.h"
48 #include "src/trace_processor/types/trace_processor_context.h"
49 
50 namespace perfetto::trace_processor {
51 
52 class FtraceParser {
53  public:
54   explicit FtraceParser(TraceProcessorContext* context);
55 
56   base::Status ParseFtraceStats(protozero::ConstBytes,
57                                 uint32_t packet_sequence_id);
58 
59   base::Status ParseFtraceEvent(uint32_t cpu,
60                                 int64_t ts,
61                                 const TracePacketData& data);
62   base::Status ParseInlineSchedSwitch(uint32_t cpu,
63                                       int64_t ts,
64                                       const InlineSchedSwitch& data);
65   base::Status ParseInlineSchedWaking(uint32_t cpu,
66                                       int64_t ts,
67                                       const InlineSchedWaking& data);
68 
69  private:
70   void ParseGenericFtrace(int64_t timestamp,
71                           uint32_t cpu,
72                           uint32_t pid,
73                           protozero::ConstBytes);
74   void ParseTypedFtraceToRaw(uint32_t ftrace_id,
75                              int64_t timestamp,
76                              uint32_t cpu,
77                              uint32_t pid,
78                              protozero::ConstBytes,
79                              PacketSequenceStateGeneration*);
80   void ParseSchedSwitch(uint32_t cpu, int64_t timestamp, protozero::ConstBytes);
81   void ParseKprobe(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
82   void ParseSchedWaking(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
83   void ParseSchedProcessFree(int64_t timestamp, protozero::ConstBytes);
84   void ParseCpuFreq(int64_t timestamp, protozero::ConstBytes);
85   void ParseCpuFreqThrottle(int64_t timestamp, protozero::ConstBytes);
86   void ParseGpuFreq(int64_t timestamp, protozero::ConstBytes);
87   void ParseKgslGpuFreq(int64_t timestamp, protozero::ConstBytes);
88   void ParseCpuIdle(int64_t timestamp, protozero::ConstBytes);
89   void ParsePrint(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
90   void ParseZero(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
91   void ParseMdssTracingMarkWrite(int64_t timestamp,
92                                  uint32_t pid,
93                                  protozero::ConstBytes);
94   void ParseSdeTracingMarkWrite(int64_t timestamp,
95                                 uint32_t pid,
96                                 protozero::ConstBytes);
97   void ParseDpuTracingMarkWrite(int64_t timestamp,
98                                 uint32_t pid,
99                                 protozero::ConstBytes);
100   void ParseG2dTracingMarkWrite(int64_t timestamp,
101                                 uint32_t pid,
102                                 protozero::ConstBytes);
103   void ParseSamsungTracingMarkWrite(int64_t timestamp,
104                                     uint32_t pid,
105                                     protozero::ConstBytes);
106   void ParseMaliTracingMarkWrite(int64_t timestamp,
107                                  uint32_t pid,
108                                  protozero::ConstBytes);
109   void ParseLwisTracingMarkWrite(int64_t timestamp,
110                                  uint32_t pid,
111                                  protozero::ConstBytes);
112   void ParseIonHeapGrowOrShrink(int64_t timestamp,
113                                 uint32_t pid,
114                                 protozero::ConstBytes,
115                                 bool grow);
116   void ParseIonStat(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
117   void ParseBclIrq(int64_t timestamp, protozero::ConstBytes);
118   void ParseDmaHeapStat(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
119   void ParseSignalGenerate(int64_t timestamp, protozero::ConstBytes);
120   void ParseSignalDeliver(int64_t timestamp,
121                           uint32_t pid,
122                           protozero::ConstBytes);
123   void ParseOOMScoreAdjUpdate(int64_t timestamp, protozero::ConstBytes);
124   void ParseOOMKill(int64_t timestamp, protozero::ConstBytes);
125   void ParseMmEventRecord(int64_t timestamp,
126                           uint32_t pid,
127                           protozero::ConstBytes);
128   void ParseSysEnterEvent(int64_t timestamp,
129                           uint32_t pid,
130                           protozero::ConstBytes);
131   void ParseSysExitEvent(int64_t timestamp,
132                          uint32_t pid,
133                          protozero::ConstBytes);
134   void ParseI2cReadEvent(int64_t timestamp,
135                          uint32_t pid,
136                          protozero::ConstBytes);
137   void ParseI2cWriteEvent(int64_t timestamp,
138                           uint32_t pid,
139                           protozero::ConstBytes);
140   void ParseI2cResultEvent(int64_t timestamp,
141                            uint32_t pid,
142                            protozero::ConstBytes);
143   void ParseTaskNewTask(int64_t timestamp,
144                         uint32_t source_tid,
145                         protozero::ConstBytes);
146   void ParseTaskRename(protozero::ConstBytes);
147   void ParseBinderTransaction(int64_t timestamp,
148                               uint32_t pid,
149                               protozero::ConstBytes);
150   void ParseBinderTransactionReceived(int64_t timestamp,
151                                       uint32_t pid,
152                                       protozero::ConstBytes);
153   void ParseBinderCommand(int64_t timestamp,
154                           uint32_t pid,
155                           protozero::ConstBytes);
156   void ParseBinderReturn(int64_t timestamp,
157                          uint32_t pid,
158                          protozero::ConstBytes);
159   void ParseBinderTransactionAllocBuf(int64_t timestamp,
160                                       uint32_t pid,
161                                       protozero::ConstBytes);
162   void ParseBinderLocked(int64_t timestamp,
163                          uint32_t pid,
164                          protozero::ConstBytes);
165   void ParseBinderLock(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
166   void ParseBinderUnlock(int64_t timestamp,
167                          uint32_t pid,
168                          protozero::ConstBytes);
169   void ParseClockSetRate(int64_t timestamp, protozero::ConstBytes);
170   void ParseClockEnable(int64_t timestamp, protozero::ConstBytes);
171   void ParseClockDisable(int64_t timestamp, protozero::ConstBytes);
172   void ParseScmCallStart(int64_t timestamp,
173                          uint32_t pid,
174                          protozero::ConstBytes);
175   void ParseScmCallEnd(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
176   void ParseCmaAllocStart(int64_t timestamp, uint32_t pid);
177   void ParseCmaAllocInfo(int64_t timestamp,
178                          uint32_t pid,
179                          protozero::ConstBytes);
180   void ParseDirectReclaimBegin(int64_t timestamp,
181                                uint32_t pid,
182                                protozero::ConstBytes);
183   void ParseDirectReclaimEnd(int64_t timestamp,
184                              uint32_t pid,
185                              protozero::ConstBytes);
186   void ParseShrinkSlabStart(int64_t timestamp,
187                             uint32_t pid,
188                             protozero::ConstBytes,
189                             PacketSequenceStateGeneration* seq_state);
190   void ParseShrinkSlabEnd(int64_t timestamp,
191                           uint32_t pid,
192                           protozero::ConstBytes);
193   void ParseWorkqueueExecuteStart(uint32_t cpu,
194                                   int64_t timestamp,
195                                   uint32_t pid,
196                                   protozero::ConstBytes,
197                                   PacketSequenceStateGeneration* seq_state);
198   void ParseWorkqueueExecuteEnd(int64_t timestamp,
199                                 uint32_t pid,
200                                 protozero::ConstBytes);
201   void ParseIrqHandlerEntry(uint32_t cpu,
202                             int64_t timestamp,
203                             protozero::ConstBytes);
204   void ParseIrqHandlerExit(uint32_t cpu,
205                            int64_t timestamp,
206                            protozero::ConstBytes);
207   void ParseSoftIrqEntry(uint32_t cpu,
208                          int64_t timestamp,
209                          protozero::ConstBytes);
210   void ParseSoftIrqExit(uint32_t cpu, int64_t timestamp, protozero::ConstBytes);
211   void ParseGpuMemTotal(int64_t timestamp, protozero::ConstBytes);
212   void ParseSchedBlockedReason(protozero::ConstBytes,
213                                PacketSequenceStateGeneration*);
214   void ParseFastRpcDmaStat(int64_t timestamp,
215                            uint32_t pid,
216                            protozero::ConstBytes);
217   void ParseCpuhpPause(int64_t, uint32_t, protozero::ConstBytes);
218   void ParseNetifReceiveSkb(uint32_t cpu,
219                             int64_t timestamp,
220                             protozero::ConstBytes);
221   void ParseNetDevXmit(uint32_t cpu, int64_t timestamp, protozero::ConstBytes);
222   void ParseInetSockSetState(int64_t timestamp,
223                              uint32_t pid,
224                              protozero::ConstBytes);
225   void ParseTcpRetransmitSkb(int64_t timestamp, protozero::ConstBytes);
226   void ParseNapiGroReceiveEntry(uint32_t cpu,
227                                 int64_t timestamp,
228                                 protozero::ConstBytes);
229   void ParseNapiGroReceiveExit(uint32_t cpu,
230                                int64_t timestamp,
231                                protozero::ConstBytes);
232   void ParseCpuFrequencyLimits(int64_t timestamp, protozero::ConstBytes);
233   void ParseKfreeSkb(int64_t timestamp, protozero::ConstBytes);
234   void ParseUfshcdCommand(int64_t timestamp, protozero::ConstBytes);
235   void ParseUfshcdClkGating(int64_t timestamp, protozero::ConstBytes);
236 
237   void ParseCrosEcSensorhubData(int64_t timestamp, protozero::ConstBytes);
238 
239   void ParseWakeSourceActivate(int64_t timestamp, protozero::ConstBytes);
240   void ParseWakeSourceDeactivate(int64_t timestamp, protozero::ConstBytes);
241   void ParseSuspendResume(int64_t timestamp,
242                           uint32_t cpu,
243                           uint32_t pid,
244                           protozero::ConstBytes);
245   void ParseSuspendResumeMinimal(int64_t timestamp, protozero::ConstBytes);
246   void ParseSchedCpuUtilCfs(int64_t timestamp, protozero::ConstBytes);
247 
248   void ParseFuncgraphEntry(int64_t timestamp,
249                            uint32_t cpu,
250                            uint32_t pid,
251                            protozero::ConstBytes blob,
252                            PacketSequenceStateGeneration* seq_state);
253   void ParseFuncgraphExit(int64_t timestamp,
254                           uint32_t cpu,
255                           uint32_t pid,
256                           protozero::ConstBytes blob,
257                           PacketSequenceStateGeneration* seq_state);
258 
259   void MaybeOnFirstFtraceEvent();
260   StringId InternedKernelSymbolOrFallback(
261       uint64_t key,
262       PacketSequenceStateGeneration* seq_state);
263   void ParseTrustySmc(uint32_t pid, int64_t timestamp, protozero::ConstBytes);
264   void ParseTrustySmcDone(uint32_t pid,
265                           int64_t timestamp,
266                           protozero::ConstBytes);
267   void ParseTrustyStdCall32(uint32_t pid,
268                             int64_t ts,
269                             protozero::ConstBytes data);
270   void ParseTrustyStdCall32Done(uint32_t pid,
271                                 int64_t ts,
272                                 protozero::ConstBytes data);
273   void ParseTrustyShareMemory(uint32_t pid, int64_t ts, protozero::ConstBytes);
274   void ParseTrustyShareMemoryDone(uint32_t pid,
275                                   int64_t ts,
276                                   protozero::ConstBytes);
277   void ParseTrustyReclaimMemory(uint32_t pid,
278                                 int64_t ts,
279                                 protozero::ConstBytes);
280   void ParseTrustyReclaimMemoryDone(uint32_t pid,
281                                     int64_t ts,
282                                     protozero::ConstBytes);
283   void ParseTrustyIrq(uint32_t pid, int64_t ts, protozero::ConstBytes);
284   void ParseTrustyIpcHandleEvent(uint32_t pid,
285                                  int64_t ts,
286                                  protozero::ConstBytes);
287   void ParseTrustyIpcConnect(uint32_t pid, int64_t ts, protozero::ConstBytes);
288   void ParseTrustyIpcConnectEnd(uint32_t pid,
289                                 int64_t ts,
290                                 protozero::ConstBytes);
291   void ParseTrustyIpcWrite(uint32_t pid, int64_t ts, protozero::ConstBytes);
292   void ParseTrustyIpcWriteEnd(uint32_t pid, int64_t ts, protozero::ConstBytes);
293   void ParseTrustyIpcRead(uint32_t pid, int64_t ts, protozero::ConstBytes);
294   void ParseTrustyIpcReadEnd(uint32_t pid, int64_t ts, protozero::ConstBytes);
295   void ParseTrustyIpcPoll(uint32_t pid, int64_t ts, protozero::ConstBytes);
296   void ParseTrustyIpcRx(uint32_t pid, int64_t ts, protozero::ConstBytes);
297   void ParseTrustyEnqueueNop(uint32_t pid, int64_t ts, protozero::ConstBytes);
298   void ParseMaliKcpuCqsSet(uint32_t pid, int64_t ts);
299   void ParseMaliKcpuCqsWaitStart(uint32_t pid, int64_t ts);
300   void ParseMaliKcpuCqsWaitEnd(uint32_t pid, int64_t ts);
301   void ParseMaliKcpuFenceSignal(uint32_t pid, int64_t ts);
302   void ParseMaliKcpuFenceWaitStart(uint32_t pid, int64_t ts);
303   void ParseMaliKcpuFenceWaitEnd(uint32_t pid, int64_t ts);
304   void ParseAndroidFsDatareadEnd(int64_t timestamp, protozero::ConstBytes);
305   void ParseAndroidFsDatareadStart(int64_t ts,
306                                    uint32_t pid,
307                                    protozero::ConstBytes);
308   StringId GetRpmStatusStringId(int32_t rpm_status_val);
309   void ParseRpmStatus(int64_t ts, protozero::ConstBytes);
310   void ParseDevicePmCallbackStart(int64_t ts,
311                                   uint32_t cpu,
312                                   uint32_t pid,
313                                   protozero::ConstBytes);
314   void ParseDevicePmCallbackEnd(int64_t ts, protozero::ConstBytes);
315   void ParsePanelWriteGeneric(int64_t timestamp,
316                               uint32_t pid,
317                               protozero::ConstBytes);
318   void ParseGoogleIccEvent(int64_t timestamp, protozero::ConstBytes);
319   void ParseGoogleIrmEvent(int64_t timestamp, protozero::ConstBytes);
320   void ParseDeviceFrequency(int64_t ts, protozero::ConstBytes blob);
321   void ParseParamSetValueCpm(protozero::ConstBytes blob);
322   void ParseBlockIoStart(int64_t ts, protozero::ConstBytes blob);
323   void ParseBlockIoDone(int64_t ts, protozero::ConstBytes blob);
324 
325   TraceProcessorContext* context_;
326   RssStatTracker rss_stat_tracker_;
327   DrmTracker drm_tracker_;
328   IostatTracker iostat_tracker_;
329   VirtioGpuTracker virtio_gpu_tracker_;
330   MaliGpuEventTracker mali_gpu_event_tracker_;
331   PkvmHypervisorCpuTracker pkvm_hyp_cpu_tracker_;
332   GpuWorkPeriodTracker gpu_work_period_tracker_;
333   ThermalTracker thermal_tracker_;
334   PixelMmKswapdEventTracker pixel_mm_kswapd_event_tracker_;
335 
336   const StringId sched_wakeup_name_id_;
337   const StringId sched_waking_name_id_;
338   const StringId cpu_id_;
339   const StringId suspend_resume_name_id_;
340   const StringId suspend_resume_minimal_name_id_;
341   const StringId suspend_resume_minimal_slice_name_id_;
342   const StringId ion_total_id_;
343   const StringId ion_change_id_;
344   const StringId ion_buffer_id_;
345   const StringId dma_buffer_id_;
346   const StringId inode_arg_id_;
347   const StringId signal_generate_id_;
348   const StringId signal_deliver_id_;
349   const StringId lmk_id_;
350   const StringId comm_name_id_;
351   const StringId signal_name_id_;
352   const StringId oom_kill_id_;
353   const StringId workqueue_id_;
354   const StringId irq_id_;
355   const StringId tcp_state_id_;
356   const StringId tcp_event_id_;
357   const StringId protocol_arg_id_;
358   const StringId napi_gro_id_;
359   const StringId tcp_retransmited_name_id_;
360   const StringId ret_arg_id_;
361   const StringId len_arg_id_;
362   const StringId direct_reclaim_nr_reclaimed_id_;
363   const StringId direct_reclaim_order_id_;
364   const StringId direct_reclaim_may_writepage_id_;
365   const StringId direct_reclaim_gfp_flags_id_;
366   const StringId vec_arg_id_;
367   const StringId io_wait_id_;
368   const StringId function_id_;
369   const StringId waker_utid_id_;
370   const StringId cros_ec_arg_num_id_;
371   const StringId cros_ec_arg_ec_id_;
372   const StringId cros_ec_arg_sample_ts_id_;
373   const StringId shrink_slab_id_;
374   const StringId shrink_name_id_;
375   const StringId shrink_total_scan_id_;
376   const StringId shrink_freed_id_;
377   const StringId shrink_priority_id_;
378   const StringId trusty_category_id_;
379   const StringId trusty_name_trusty_std_id_;
380   const StringId trusty_name_tipc_rx_id_;
381   const StringId cma_alloc_id_;
382   const StringId cma_name_id_;
383   const StringId cma_pfn_id_;
384   const StringId cma_req_pages_id_;
385   const StringId cma_nr_migrated_id_;
386   const StringId cma_nr_reclaimed_id_;
387   const StringId cma_nr_mapped_id_;
388   const StringId cma_nr_isolate_fail_id_;
389   const StringId cma_nr_migrate_fail_id_;
390   const StringId cma_nr_test_fail_id_;
391   const StringId syscall_ret_id_;
392   const StringId syscall_args_id_;
393   const StringId replica_slice_id_;
394   const StringId file_path_id_;
395   const StringId offset_id_start_;
396   const StringId offset_id_end_;
397   const StringId bytes_read_id_start_;
398   const StringId bytes_read_id_end_;
399   const StringId android_fs_category_id_;
400   const StringId android_fs_data_read_id_;
401   const StringId google_icc_event_id_;
402   const StringId google_irm_event_id_;
403   const StringId runtime_status_invalid_id_;
404   const StringId runtime_status_active_id_;
405   const StringId runtime_status_suspending_id_;
406   const StringId runtime_status_resuming_id_;
407   const StringId suspend_resume_main_event_id_;
408   const StringId suspend_resume_device_pm_event_id_;
409   const StringId suspend_resume_utid_arg_name_;
410   const StringId suspend_resume_device_arg_name_;
411   const StringId suspend_resume_driver_arg_name_;
412   const StringId suspend_resume_callback_phase_arg_name_;
413   const StringId suspend_resume_event_type_arg_name_;
414   const StringId device_name_id_;
415   const StringId block_io_id_;
416   const StringId block_io_arg_sector_id_;
417 
418   std::vector<StringId> syscall_arg_name_ids_;
419 
420   struct FtraceMessageStrings {
421     // The string id of name of the event field (e.g. sched_switch's id).
422     StringId message_name_id = kNullStringId;
423     std::array<StringId, kMaxFtraceEventFields> field_name_ids;
424   };
425   std::vector<FtraceMessageStrings> ftrace_message_strings_;
426 
427   struct MmEventCounterNames {
428     MmEventCounterNames() = default;
MmEventCounterNamesMmEventCounterNames429     MmEventCounterNames(StringId _count, StringId _max_lat, StringId _avg_lat)
430         : count(_count), max_lat(_max_lat), avg_lat(_avg_lat) {}
431 
432     StringId count = kNullStringId;
433     StringId max_lat = kNullStringId;
434     StringId avg_lat = kNullStringId;
435   };
436 
437   // Keep kMmEventCounterSize equal to mm_event_type::MM_TYPE_NUM in the kernel.
438   static constexpr size_t kMmEventCounterSize = 7;
439   std::array<MmEventCounterNames, kMmEventCounterSize> mm_event_counter_names_;
440 
441   // Record number of received bytes from the network interface card.
442   std::unordered_map<std::string, uint64_t> nic_received_bytes_;
443 
444   // Record number of transmitted bytes to the network interface card.
445   std::unordered_map<std::string, uint64_t> nic_transmitted_bytes_;
446 
447   // Record number of kfree_skb with ip protocol.
448   uint64_t num_of_kfree_skb_ip_prot = 0;
449 
450   // Keep sock to stream number mapping.
451   std::unordered_map<uint64_t, uint32_t> skaddr_to_stream_;
452 
453   // Record number of tcp steams.
454   uint32_t num_of_tcp_stream_ = 0;
455 
456   // A name collision is possible, always show if active wakelock exists
457   // with a give name
458   std::unordered_map<std::string, uint32_t> active_wakelock_to_count_;
459 
460   // Tiny state machine for tracking the suspend_enter bug.
461   enum SuspendEnterBugState {
462     // Nothing special.
463     SUSPEND_STATE_INITIAL,
464     // We are inside a suspend_enter slice.
465     SUSPEND_STATE_ENTER,
466     // We are inside a suspend_enter slice and a freeze_processes slice.
467     SUSPEND_STATE_FREEZE
468   };
469 
470   SuspendEnterBugState suspend_state_ = SUSPEND_STATE_INITIAL;
471 
472   // cookie for the current suspend_enter slice if any; needed to close it.
473   int64_t suspend_enter_slice_cookie_ = 0;
474 
475   bool has_seen_first_ftrace_packet_ = false;
476 
477   // Ftrace events before this timestamp get dropped.
478   int64_t drop_ftrace_data_before_ts_ = 0;
479 
480   // Ftrace events before this timestamp get parsed into the |ftrace_events|
481   // table, but don't get propagated into other tables/trackers.
482   // Must be no less than drop_ftrace_data_before_ts_.
483   int64_t soft_drop_ftrace_data_before_ts_ = 0;
484 
485   // Does not skip any ftrace events.
486   bool preserve_ftrace_buffer_ = false;
487 
488   // Sequence ids for which ftrace_errors have been seen. Used to avoid
489   // putting them in the metadata multiple times (the ftrace data sources
490   // re-emits begin stats on every flush).
491   std::unordered_set<uint32_t> seen_errors_for_sequence_id_;
492 
493   // Tracks Linux devices with active runtime power management (RPM) status
494   // slices.
495   std::unordered_set<TrackId> active_rpm_tracks_;
496 
497   struct PairHash {
operatorPairHash498     std::size_t operator()(const std::pair<uint64_t, int64_t>& p) const {
499       base::Hasher hasher;
500       hasher.Update(p.first);
501       hasher.Update(p.second);
502       return static_cast<std::size_t>(hasher.digest());
503     }
504   };
505 
506   base::FlatHashMap<std::pair<uint64_t, int64_t>, uint32_t, PairHash>
507       inode_offset_thread_map_;
508 };
509 
510 }  // namespace perfetto::trace_processor
511 
512 #endif  // SRC_TRACE_PROCESSOR_IMPORTERS_FTRACE_FTRACE_PARSER_H_
513