Skip to content

Commit

Permalink
Account getRunDuration in the cache report of BasicCCDBManager
Browse files Browse the repository at this point in the history
  • Loading branch information
shahor02 committed Mar 5, 2024
1 parent 14189ae commit f8e40c9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CCDB/include/CCDB/BasicCCDBManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class CCDBManagerInstance
/// A convenience function for MC to fetch
/// valid start and end timestamps given an ALICE run number.
/// On error it fatals (if fatal == true) or else returns the pair -1, -1.
std::pair<int64_t, int64_t> getRunDuration(int runnumber, bool fatal = true) const;
std::pair<int64_t, int64_t> getRunDuration(int runnumber, bool fatal = true);

/// A convenience function for MC to fetch
/// valid start and end timestamps given an ALICE run number.
Expand Down
21 changes: 19 additions & 2 deletions CCDB/src/BasicCCDBManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,26 @@ std::pair<int64_t, int64_t> CCDBManagerInstance::getRunDuration(o2::ccdb::CcdbAp
return std::make_pair(sor, eor);
}

std::pair<int64_t, int64_t> CCDBManagerInstance::getRunDuration(int runnumber, bool fatal) const
std::pair<int64_t, int64_t> CCDBManagerInstance::getRunDuration(int runnumber, bool fatal)
{
return CCDBManagerInstance::getRunDuration(mCCDBAccessor, runnumber, fatal);
mQueries++;
if (!isCachingEnabled()) {
return CCDBManagerInstance::getRunDuration(mCCDBAccessor, runnumber, fatal);
}
auto& cached = mCache["RCT-Run-Info HeaderOnly"];
std::pair<int64_t, int64_t> rd;
cached.queries++;
if (cached.startvalidity != runnumber) { // need to fetch
rd = CCDBManagerInstance::getRunDuration(mCCDBAccessor, runnumber, fatal);
cached.objPtr = std::make_shared<std::pair<int64_t, int64_t>>(rd);
cached.startvalidity = runnumber;
cached.endvalidity = runnumber + 1;
cached.minSize = cached.maxSize = 0;
cached.fetches++;
} else {
rd = *reinterpret_cast<std::pair<int64_t, int64_t>*>(cached.objPtr.get());
}
return rd;
}

std::string CCDBManagerInstance::getSummaryString() const
Expand Down

0 comments on commit f8e40c9

Please sign in to comment.