10#include <TBenchmark.h>
13#include <TTreeCache.h>
23void EL::MetricsSvc :: testInvariant ()
const
28const char *EL::MetricsSvc :: GetName()
const
35EL::MetricsSvc :: MetricsSvc ()
44EL::MetricsSvc :: ~MetricsSvc ()
57 wk()->addOutput (
m_fileMetrics =
new TTree (
"EventLoop_Metrics/cacheStats",
58 "TTree cache stats per file"));
59 wk()->addOutput (
m_jobMetrics =
new TTree (
"EventLoop_Metrics/jobs",
60 "event throughput per job"));
61 return EL::StatusCode::SUCCESS;
70 return EL::StatusCode::SUCCESS;
81 TTreeCache *
tc = (TTreeCache*)
wk()->inputFile()->GetCacheRead(
wk()->
tree());
83 Int_t nBranches =
tc->GetCachedBranches()->GetEntries();
84 m_fileMetrics->Branch (
"nBranches", &nBranches,
"nBranches/I");
85 Int_t nLearn =
tc->GetLearnEntries();
86 m_fileMetrics->Branch (
"learnEntries", &nLearn,
"learnEntries/I");
87 Double_t eff =
tc->GetEfficiency ();
88 m_fileMetrics->Branch (
"cacheEfficiency", &eff,
"cacheEfficiency/D");
89 Double_t effRel =
tc->GetEfficiencyRel ();
90 m_fileMetrics->Branch (
"cacheEfficiencyRel", &effRel,
"cacheEfficiencyRel/D");
91 Long64_t bytesRead =
tc->GetBytesRead ();
92 m_fileMetrics->Branch (
"bytesRead", &bytesRead,
"bytesRead/L");
93 Int_t readCalls =
tc->GetReadCalls ();
94 m_fileMetrics->Branch (
"readCalls", &readCalls,
"readCalls/I");
95 Long64_t ncBytesRead =
tc->GetNoCacheBytesRead ();
96 m_fileMetrics->Branch (
"noCacheBytesRead", &ncBytesRead,
"noCacheBytesRead/L");
97 Int_t ncReadCalls =
tc->GetNoCacheReadCalls ();
98 m_fileMetrics->Branch (
"noCacheReadCalls", &ncReadCalls,
"noCacheReadCalls/I");
99 Int_t readahead = TFile::GetReadaheadSize ();
100 m_fileMetrics->Branch (
"readaheadSize", &readahead,
"readaheadSize/I");
101 Long64_t bytesReadExtra =
tc->GetBytesReadExtra ();
102 m_fileMetrics->Branch (
"bytesReadExtra", &bytesReadExtra,
"bytesReadExtra/L");
105 return EL::StatusCode::SUCCESS;
114 return EL::StatusCode::SUCCESS;
125 Float_t realTime =
m_benchmark->GetRealTime(
"loopmetrics");
126 m_jobMetrics->Branch(
"loopWallTime", &realTime,
"loopWallTime/F");
127 Float_t cpuTime =
m_benchmark->GetCpuTime(
"loopmetrics");
128 m_jobMetrics->Branch(
"loopCpuTime", &cpuTime,
"loopCpuTime/F");
129 Float_t evtsWallSec =
m_eventsRead / (realTime != 0 ? realTime : 1.);
130 m_jobMetrics->Branch(
"eventsPerWallSec", &evtsWallSec,
"eventsPerWallSec/F");
131 Float_t evtsCpuSec =
m_eventsRead / (cpuTime != 0 ? cpuTime : 1.);
132 m_jobMetrics->Branch(
"eventsPerCpuSec", &evtsCpuSec,
"eventsPerCpuSec/F");
134 return EL::StatusCode::SUCCESS;
#define RCU_DESTROY_INVARIANT(x)
#define RCU_CHANGE_INVARIANT(x)
#define RCU_NEW_INVARIANT(x)
#define RCU_READ_INVARIANT(x)
ClassImp(EL::MetricsSvc) namespace EL
IWorker * wk() const
description: the worker that is controlling us guarantee: no-fail
Int_t m_filesRead
description: the number of files processed
Int_t m_eventsRead
description: the number of events processed
TTree * m_fileMetrics
description: the file cache metrics
TTree * m_jobMetrics
description: the job metrics
TBenchmark * m_benchmark
description: the benchmark object used rationale: this is a pointer to avoid including the header in ...
static const std::string name
description: the name of the service
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.