File indexing completed on 2026-06-05 08:45:31
0001
0002
0003
0004 #pragma once
0005
0006 #include <JANA/JVersion.h>
0007 #include <JANA/JService.h>
0008
0009 #if JANA2_HAVE_PERFETTO
0010 #include <perfetto.h>
0011
0012
0013 PERFETTO_DEFINE_CATEGORIES(
0014 perfetto::Category("jana").SetDescription("JANA2 framework events (arrow dispatch)"),
0015 perfetto::Category("factory").SetDescription("JANA2 factory Process() execution per event"),
0016 perfetto::Category("factory_init").SetDescription("JANA2 factory Init() callback (first activation only)"),
0017 perfetto::Category("factory_begin_run").SetDescription("JANA2 factory BeginRun() callback"),
0018 perfetto::Category("factory_change_run").SetDescription("JANA2 factory ChangeRun() callback"),
0019 perfetto::Category("factory_end_run").SetDescription("JANA2 factory EndRun() callback")
0020 );
0021 #endif
0022
0023 class JPerfettoService : public JService {
0024
0025 public:
0026 JPerfettoService() = default;
0027 ~JPerfettoService() override;
0028
0029 void Init() override;
0030
0031
0032 static void RegisterCurrentThread(int worker_id);
0033
0034 private:
0035 #if JANA2_HAVE_PERFETTO
0036 std::unique_ptr<perfetto::TracingSession> m_tracing_session;
0037 #endif
0038 std::string m_output_file = "jana_trace.perfetto";
0039 bool m_enabled = true;
0040 };