330 const char *bname = b->
GetName();
339 if (b != b->
GetMother() && mothername[strlen(mothername)-1] !=
'.') {
342 if (bem->GetType() < 3) {
346 if (strncmp(bname,build.
Data(),build.
Length()) != 0) {
348 bname = build.
Data();
363 for (
Int_t j = 0; j < nb; j++) {
365 if (!branch)
continue;
390 TLeaf *leaf, *leafcount;
401 if (!strcmp(bname,
"*")) all =
kTRUE;
402 for (i=0;i<nleaves;i++) {
409 if (strcmp(bname,branch->
GetName())
418 if (leafcount && !all) {
425 if (nb==0 && strchr(bname,
'*')==0) {
446 char *subbranch = (
char*)strstr(bname,fe->GetName());
447 if (subbranch!=bname) subbranch = 0;
449 subbranch += strlen(fe->GetName());
450 if ( *subbranch !=
'.' ) subbranch = 0;
462 if (!nb && !foundInFriend) {
463 if (
gDebug > 0) printf(
"AddBranch: unknown branch -> %s \n", bname);
464 Error(
"AddBranch",
"unknown branch -> %s", bname);
503 for (
Int_t j = 0; j < nb; j++) {
505 if (!branch)
continue;
530 TLeaf *leaf, *leafcount;
541 if (!strcmp(bname,
"*")) all =
kTRUE;
542 for (i=0;i<nleaves;i++) {
549 if (strcmp(bname,branch->
GetName())
558 if (leafcount && !all) {
565 if (nb==0 && strchr(bname,
'*')==0) {
586 char *subbranch = (
char*)strstr(bname,fe->GetName());
587 if (subbranch!=bname) subbranch = 0;
589 subbranch += strlen(fe->GetName());
590 if ( *subbranch !=
'.' ) subbranch = 0;
602 if (!nb && !foundInFriend) {
603 if (
gDebug > 0) printf(
"DropBranch: unknown branch -> %s \n", bname);
604 Error(
"DropBranch",
"unknown branch -> %s", bname);
687 if (basketOffset < 0) {
700 Int_t len = lbaskets[basketOffset];
741 TBranch *resultBranch =
nullptr;
744 std::vector<std::pair<size_t, Int_t>> basketsInfo;
748 for (
int i = 0; i < count; i++) {
753 if (iopos.fLen == 0) {
756 if (iopos.fPos == pos && iopos.fLen == len) {
757 found_request =
kTRUE;
762 fMissCache->fEntries.emplace_back(std::move(iopos));
766 Int_t basketNumber = -1;
767 for (
Int_t bn = 0; bn < blistsize; ++bn) {
773 if (basketNumber >= 0)
774 basketsInfo.emplace_back((
size_t)i, basketNumber);
783 for (
auto &info : basketsInfo) {
784 perfStats->SetLoadedMiss(info.first, info.second);
835 std::vector<Long64_t> positions;
836 positions.reserve(
fMissCache->fEntries.size());
837 std::vector<Int_t> lengths;
841 positions.push_back(mcentry.fIO.fPos);
842 lengths.push_back(mcentry.fIO.fLen);
843 mcentry.fIndex = cumulative;
844 cumulative += mcentry.fIO.fLen;
876 auto iter = std::lower_bound(
fMissCache->fEntries.begin(),
fMissCache->fEntries.end(), mcentry);
879 if (len > iter->fIO.fLen) {
883 auto offset = iter->fIndex;
884 memcpy(buf, &(
fMissCache->fData[offset]), len);
904 auto offset = iter->fIndex;
906 memcpy(buf, &(
fMissCache->fData[offset]), len);
922 struct BasketRanges {
927 Range() : fMin(-1), fMax(-1) {}
931 if (fMin == -1 || min < fMin)
937 if (fMax == -1 || fMax < max)
941 Bool_t Contains(
Long64_t entry) {
return (fMin <= entry && entry <= fMax); }
944 std::vector<Range> fRanges;
945 std::map<Long64_t,size_t> fMinimums;
946 std::map<Long64_t,size_t> fMaximums;
948 BasketRanges(
size_t nBranches) { fRanges.resize(nBranches); }
952 Range &range = fRanges.at(branchNumber);
955 range.UpdateMin(min);
956 range.UpdateMax(max);
958 if (old.fMax != range.fMax) {
959 if (old.fMax != -1) {
960 auto maxIter = fMaximums.find(old.fMax);
961 if (maxIter != fMaximums.end()) {
962 if (maxIter->second == 1) {
963 fMaximums.erase(maxIter);
973 void Update(
size_t branchNumber,
size_t basketNumber,
Long64_t *entries,
size_t nb,
size_t max)
975 Update(branchNumber, entries[basketNumber],
976 (basketNumber < (nb - 1)) ? (entries[basketNumber + 1] - 1) : max - 1);
980 bool CheckAllIncludeRange()
983 for (
const auto &
r : fRanges) {
984 if (result.fMin == -1 || result.fMin <
r.fMin) {
986 result.fMin =
r.fMin;
988 if (result.fMax == -1 ||
r.fMax < result.fMax) {
990 result.fMax =
r.fMax;
997 Range allIncludedRange(AllIncludedRange());
999 return (result.fMin == allIncludedRange.fMin && result.fMax == allIncludedRange.fMax);
1009 Range AllIncludedRange()
1012 if (!fMinimums.empty())
1013 result.fMin = fMinimums.rbegin()->first;
1014 if (!fMaximums.empty())
1015 result.fMax = fMaximums.begin()->first;
1020 UInt_t BranchesRegistered()
1023 for (
const auto &
r : fRanges) {
1024 if (
r.fMin != -1 &&
r.fMax != -1)
1034 for (
const auto &
r : fRanges) {
1035 if (
r.fMin != -1 &&
r.fMax != -1)
1036 if (
r.fMin <= entry && entry <=
r.fMax)
1044 for (
size_t i = 0; i < fRanges.size(); ++i) {
1045 if (fRanges[i].fMin != -1 || fRanges[i].fMax != -1)
1046 Printf(
"Range #%zu : %lld to %lld", i, fRanges[i].fMin, fRanges[i].fMax);
1104 if (entry < 0) entry = 0;
1110 if (entry < 0)
return kFALSE;
1116 if (entry < 0 && fEntryNext > 0) {
1136 static constexpr
bool showMore =
kFALSE;
1145 if (showMore ||
gDebug > 6)
1146 Info(
"FillBuffer",
"***** Called for entry %lld", entry);
1161 if (showMore ||
gDebug > 5)
1162 Info(
"FillBuffer",
"All baskets used already, so refresh the cache early at entry %lld", entry);
1181 resetBranchInfo =
kTRUE;
1182 if (showMore ||
gDebug > 6)
1183 Info(
"FillBuffer",
"*** Will reset the branch information about baskets");
1184 }
else if (showMore ||
gDebug > 6) {
1185 Info(
"FillBuffer",
"*** Info we have on the set of baskets");
1192 auto entryCurrent = clusterIter();
1207 if (showMore ||
gDebug > 6)
1221 if (resetBranchInfo) {
1224 if (!(fEntryCurrent < fCurrentClusterStart || fEntryCurrent >=
fNextClusterStart)) {
1225 Error(
"FillBuffer",
"Inconsistency: fCurrentClusterStart=%lld fEntryCurrent=%lld fNextClusterStart=%lld " 1226 "but fEntryCurrent should not be in between the two",
1250 Int_t ntotCurrentBuf = 0;
1254 ntotCurrentBuf =
fNtot;
1263 ntotCurrentBuf =
fNtot;
1270 Int_t clusterIterations = 0;
1274 Int_t nReadPrefRequest = 0;
1277 prevNtot = ntotCurrentBuf;
1280 struct collectionInfo {
1281 Int_t fClusterStart{-1};
1285 void Rewind() { fCurrent = (fClusterStart >= 0) ? fClusterStart : 0; }
1287 std::vector<collectionInfo> cursor(
fNbranches);
1291 Int_t nDistinctLoad = 0;
1303 auto CollectBaskets = [
this, elist, chainOffset, entry, clusterIterations, resetBranchInfo, perfStats,
1304 &cursor, &lowestMaxEntry, &maxReadEntry, &minEntry,
1305 &reachedEnd, &skippedFirst, &oncePerBranch, &nDistinctLoad, &progress,
1306 &ranges, &memRanges, &reqRanges,
1307 &ntotCurrentBuf, &nReadPrefRequest](EPass pass, ENarrow narrow,
Long64_t maxCollectEntry) {
1311 Int_t nReachedEnd = 0;
1313 auto oldnReadPrefRequest = nReadPrefRequest;
1314 std::vector<Int_t> potentialVetoes;
1316 if (showMore ||
gDebug > 7)
1317 Info(
"CollectBaskets",
"Called with pass=%d narrow=%d maxCollectEntry=%lld", pass, narrow, maxCollectEntry);
1326 potentialVetoes.clear();
1327 if (pass == kStart && !cursor[i].fLoadedOnce && resetBranchInfo) {
1332 if (showMore ||
gDebug > 7) {
1334 for(
auto v : potentialVetoes) {
1338 if (!potentialVetoes.empty())
1339 Info(
"FillBuffer",
"*** Potential Vetos for branch #%d: %s", i, vetolist.
Data());
1346 if (!lbaskets || !entries)
1352 auto maxOfBasket = [
this, nb, entries](
int j) {
1353 return ((j < (nb - 1)) ? (entries[j + 1] - 1) :
fEntryMax - 1);
1356 if (pass == kRewind)
1358 for (
auto &j = cursor[i].fCurrent; j < nb; j++) {
1361 if (j < blistsize && b->GetListOfBaskets()->UncheckedAt(j)) {
1363 if (showMore ||
gDebug > 6) {
1364 ranges.Update(i, entries[j], maxOfBasket(j));
1365 memRanges.Update(i, entries[j], maxOfBasket(j));
1367 if (entries[j] <= entry && entry <= maxOfBasket(j)) {
1383 if (entries[j] >= maxCollectEntry) {
1389 Int_t len = lbaskets[j];
1390 if (pos <= 0 || len <= 0)
1394 if ((showMore ||
gDebug > 7) &&
1395 (!(entries[j] < minEntry && (j < nb - 1 && entries[j + 1] <= minEntry))))
1396 Info(
"FillBuffer",
"Skipping branch %s basket %d is too large for the cache: %d > %d",
1401 if (nReadPrefRequest && entries[j] > (reqRanges.AllIncludedRange().fMax + 1)) {
1411 if (showMore ||
gDebug > 8)
1412 Info(
"FillBuffer",
"Skipping for now due to gap %d/%d with %lld > %lld", i, j, entries[j],
1413 (reqRanges.AllIncludedRange().fMax + 1));
1417 if (entries[j] < minEntry && (j<nb-1 && entries[j+1] <= minEntry))
1421 if (cursor[i].fClusterStart == -1)
1422 cursor[i].fClusterStart = j;
1427 emax = entries[j + 1] - 1;
1428 if (!elist->
ContainsRange(entries[j]+chainOffset,emax+chainOffset))
1435 if (showMore ||
gDebug > 7)
1440 if (std::find(std::begin(potentialVetoes), std::end(potentialVetoes), j) != std::end(potentialVetoes)) {
1448 if (showMore ||
gDebug > 7)
1449 Info(
"FillBuffer",
"Veto-ing cluster %d [%lld,%lld[ in branch %s #%d", j, entries[j],
1450 maxOfBasket(j) + 1, b->
GetName(), i);
1455 if ((((entries[j] > entry)) || (j < nb - 1 && entries[j + 1] <= entry))) {
1457 if (j == cursor[i].fClusterStart && entry > entries[j])
1459 if (entries[j] > entry)
1468 if (clusterIterations > 0 && cursor[i].fLoadedOnce) {
1472 if (showMore ||
gDebug > 5) {
1475 "Breaking early because %d is greater than %d at cluster iteration %d will restart at %lld",
1476 (ntotCurrentBuf + len),
fBufferSizeMin, clusterIterations, minEntry);
1482 if (pass == kStart || !cursor[i].fLoadedOnce) {
1490 if (showMore ||
gDebug > 5) {
1491 Info(
"FillBuffer",
"Breaking early because %d is greater than 4*%d at cluster iteration " 1492 "%d pass %d will restart at %lld",
1504 if (showMore ||
gDebug > 5) {
1505 Info(
"FillBuffer",
"Breaking early because %d is greater than 2*%d at cluster iteration " 1506 "%d pass %d will restart at %lld",
1518 reqRanges.Update(i, j, entries, nb,
fEntryMax);
1519 if (showMore ||
gDebug > 6)
1520 ranges.Update(i, j, entries, nb,
fEntryMax);
1524 if (showMore ||
gDebug > 6)
1525 Info(
"FillBuffer",
"*** Registering branch %d basket %d %s", i, j, b->
GetName());
1527 if (!cursor[i].fLoadedOnce) {
1528 cursor[i].fLoadedOnce =
kTRUE;
1532 perfStats->SetLoaded(i, j);
1539 ntotCurrentBuf =
fNtot;
1548 ntotCurrentBuf =
fNtot;
1551 if ( ( j < (nb-1) ) && entries[j+1] > maxReadEntry ) {
1553 maxReadEntry = entries[j+1];
1557 Warning(
"FillBuffer",
"There is more data in this cluster (starting at entry %lld to %lld, " 1558 "current=%lld) than usual ... with %d %.3f%% of the branches we already have " 1559 "%d bytes (instead of %d)",
1563 if (pass == kStart) {
1565 auto high = maxOfBasket(j);
1566 if (high < lowestMaxEntry)
1567 lowestMaxEntry = high;
1571 }
else if ((j + 1) == nb || entries[j + 1] >= maxReadEntry || entries[j + 1] >= lowestMaxEntry) {
1573 auto high = maxOfBasket(j);
1574 if (high < lowestMaxEntry)
1575 lowestMaxEntry = high;
1582 if (cursor[i].fCurrent == nb) {
1587 Info(
"CollectBaskets",
1588 "Entry: %lld, registering baskets branch %s, fEntryNext=%lld, fNseek=%d, ntotCurrentBuf=%d",
1592 skippedFirst = (nSkipped > 0);
1593 oncePerBranch = (nDistinctLoad ==
fNbranches);
1594 progress = nReadPrefRequest - oldnReadPrefRequest;
1601 full = CollectBaskets(kStart, kNarrow,
fEntryNext);
1605 while (!full && !reachedEnd && progress) {
1606 full = CollectBaskets(kStart, kFull, std::min(maxReadEntry,
fEntryNext));
1609 resetBranchInfo =
kFALSE;
1614 full = CollectBaskets(kRegular, kFull,
fEntryNext);
1615 }
while (!full && !reachedEnd && progress);
1619 if (!full && skippedFirst) {
1620 full = CollectBaskets(kRewind, kFull,
fEntryNext);
1621 while (!full && !reachedEnd && progress) {
1622 full = CollectBaskets(kRegular, kFull,
fEntryNext);
1626 clusterIterations++;
1628 minEntry = clusterIter.
Next();
1646 (prevNtot < ntotCurrentBuf) && (minEntry <
fEntryMax))) {
1647 if (showMore ||
gDebug > 6)
1648 Info(
"FillBuffer",
"Breaking because %d <= %lld || (%d >= %d) || %lld >= %lld",
fBufferSizeMin,
1649 ((
Long64_t)ntotCurrentBuf * (clusterIterations + 1)) / clusterIterations, prevNtot, ntotCurrentBuf,
1658 if (minEntry >= fEntryCurrentMax && fEntryCurrentMax > 0)
1666 if (showMore ||
gDebug > 6) {
1667 Info(
"FillBuffer",
"Mem ranges");
1669 Info(
"FillBuffer",
"Combined ranges");
1671 Info(
"FillBuffer",
"Requested ranges");
1676 if (nReadPrefRequest == 0) {
1680 if (showMore ||
gDebug > 5) {
1681 Info(
"FillBuffer",
"For entry %lld, nothing was added to the cache.", entry);
1683 }
else if (
fEntryNext < firstClusterEnd && !reqRanges.Contains(entry)) {
1695 if (showMore ||
gDebug > 5) {
1696 Error(
"FillBuffer",
"Reset the next entry because the currently loaded range does not contains the request " 1697 "entry: %lld. fEntryNext updated from %lld to %lld. %d",
1698 entry,
fEntryNext, firstClusterEnd, nReadPrefRequest);
1704 if (showMore ||
gDebug > 5) {
1705 Info(
"FillBuffer",
"Complete adding %d baskets from %d branches taking in memory %d out of %d",
1706 nReadPrefRequest, reqRanges.BranchesRegistered(), ntotCurrentBuf,
fBufferSizeMin);
1735 if (!(stcp =
gSystem->
Getenv(
"ROOT_TTREECACHE_PREFILL")) || !*stcp) {
1833 printf(
"Number of branches in the cache ...: %d\n",
fNbranches);
1834 printf(
"Cache Efficiency ..................: %f\n",
GetEfficiency());
1839 if ( opt.
Contains(
"cachedbranches") ) {
1841 printf(
"Cached branches....................:\n");
1844 for (
Int_t i = 0; i < nbranches; ++i) {
1846 printf(
"Branch name........................: %s\n",branch->
GetName());
1865 ::Info(
"TTreeCache::ReadBufferNormal",
"Cache miss after an %s FillBuffer: pos=%lld",
1866 bufferFilled ?
"active" :
"inactive", basketpos);
1867 for (
Int_t i = 0; i < branches->GetEntries(); ++i) {
1870 for (
Int_t j = 0; j < blistsize; ++j) {
1873 ::Info(
"TTreeCache::ReadBufferNormal",
" Missing basket: %d for %s", j, b->
GetName());
1887 else if (res == 0) {
1891 recordMiss(perfStats,
fBranches, bufferFilled, pos);
1904 recordMiss(perfStats,
fBranches, bufferFilled, pos);
1995 if (res == 0 && buffersize <= prevsize) {
2030 Info(
"SetEntryRange",
"fEntryMin=%lld, fEntryMax=%lld, fEntryNext=%lld",
2033 if (needLearningStart) {
Bool_t CheckMissCache(char *buf, Long64_t pos, int len)
Check the miss cache for a particular buffer, fetching if deemed necessary.
virtual const char * GetName() const
Returns name of object.
Int_t fNtot
Total size of prefetched blocks.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Long64_t fEntryMax
! last entry in the cache
Long64_t * GetBasketEntry() const
Double_t GetMissEfficiencyRel() const
Relative efficiency of the 'miss cache' - ratio of the reads found in cache to the number of reads so...
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Int_t fNReadOk
Number of blocks read and found in the cache.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
TFile * fFile
Pointer to file.
virtual void SetMissed(TBranch *b, size_t basketNumber)=0
const TObjArray * GetCachedBranches() const
#define R__unlikely(expr)
TObjArray * GetListOfBaskets()
Collectable string class.
Provides the interface for the PROOF internal performance measurement and event tracing.
TObjArray * fBranches
! List of branches to be stored in the cache
A cache when reading files over the network.
Long64_t fLastMiss
! set to the event # of the last miss.
Bool_t fOneTime
! used in the learning phase
Int_t fNMissReadMiss
Number of blocks read and not found in either cache.
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=0, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void SetLearnPrefill(EPrefillType type=kNoPrefill)
Set whether the learning period is started with a prefilling of the cache and which type of prefillin...
A specialized TFileCacheRead object for a TTree.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual Int_t GetEntries() const
virtual TList * GetListOfFriends() const
virtual Long64_t GetAutoFlush() const
Regular expression class.
TDirectory * GetDirectory() const
Bool_t IsInCache(Int_t basketNumber) const
virtual TObject * Remove(TObject *obj)
Remove object from array.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Long64_t fEntryMin
! first entry in the cache
void ToLower()
Change string to lower-case.
virtual void Prefetch(Long64_t pos, Int_t len)
Add block of length len at position pos in the list of blocks to be prefetched.
virtual void StopLearningPhase()
This is the counterpart of StartLearningPhase() and can be used to stop the learning phase...
virtual void LearnPrefill()
Perform an initial prefetch, attempting to read as much of the learning phase baskets for all branche...
void StartLearningPhase()
The name should be enough to explain the method.
virtual Int_t AddBranch(TBranch *b, Bool_t subgbranches=kFALSE)
Add a branch to the list of branches to be stored in the cache this function is called by TBranch::Ge...
Long64_t * GetTreeOffset() const
Bool_t IsVetoed(Int_t basketNumber) const
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Int_t fNMissReadPref
Number of blocks read into the secondary ("miss") cache.
Long64_t fNextClusterStart
! End+1 of the cluster(s) where the current content was picked out
virtual Int_t ReadBufferNormal(char *buf, Long64_t pos, Int_t len)
Old method ReadBuffer before the addition of the prefetch mechanism.
IOPos FindBranchBasketPos(TBranch &, Long64_t entry)
Given a branch and an entry, determine the file location (offset / size) of the corresponding basket...
Helper class to iterate over cluster of baskets.
Int_t * GetBasketBytes() const
void Veto(Int_t basketNumber)
virtual void SecondPrefetch(Long64_t, Int_t)
virtual void Print(Option_t *option="") const
Print cache statistics.
Bool_t fOptimizeMisses
! true if we should optimize cache misses.
virtual Long64_t GetReadEntry() const
Bool_t fIsTransferred
True when fBuffer contains something valid.
virtual Bool_t ContainsRange(Long64_t entrymin, Long64_t entrymax)
Return TRUE if list contains entries from entrymin to entrymax included.
virtual TVirtualPerfStats * GetPerfStats() const
virtual const char * Getenv(const char *env)
Get environment variable.
virtual TClusterIterator GetClusterIterator(Long64_t firstentry)
Return an iterator over the cluster of baskets starting at firstentry.
TString & Append(const char *cs)
virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len)
Read buffer at position pos if the request is in the list of prefetched blocks read from fBuffer...
virtual void ResetCache()
This will simply clear the cache.
Bool_t fEnabled
! cache enabled for cached reading
TBranch * CalculateMissEntries(Long64_t, int, bool)
Given an file read, try to determine the corresponding branch.
TObjArray * GetListOfBranches()
virtual TFile * GetFile() const
Double_t GetEfficiencyRel() const
This will indicate a sort of relative efficiency...
virtual TTree * GetTree() const
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
TTree * fTree
! pointer to the current Tree
void PrintCacheInfo() const
Print the information we have about which basket is currently cached and whether they have been 'used...
const char * GetName() const
Returns name of object.
EPrefillType GetConfiguredPrefillType() const
Return the desired prefill type from the environment or resource variable.
virtual void SetEntryRange(Long64_t emin, Long64_t emax)
Set the minimum and maximum entry number to be processed this information helps to optimize the numbe...
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
virtual Int_t DropBranch(TBranch *b, Bool_t subbranches=kFALSE)
Remove a branch to the list of branches to be stored in the cache this function is called by TBranch:...
CacheInfo_t fCacheInfo
! Hold info about which basket are in the cache and if they have been retrieved from the cache...
R__EXTERN TSystem * gSystem
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual Int_t ReadBufferPrefetch(char *buf, Long64_t pos, Int_t len)
Used to read a chunk from a block previously fetched.
Int_t GetWriteBasket() const
virtual ~TTreeCache()
Destructor. (in general called by the TFile destructor)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Int_t GetEntriesFast() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual TLeaf * GetLeafCount() const
If this leaf stores a variable-sized array or a multi-dimensional array whose last dimension has vari...
virtual void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Set the file using this cache and reset the current blocks (if any).
Int_t GetMaxBaskets() const
A TEventList object is a list of selected events (entries) in a TTree.
Bool_t fReadDirectionSet
! read direction established
Int_t fNReadMiss
Number of blocks read and not found in the cache.
static void SetLearnEntries(Int_t n=10)
Static function to set the number of entries to be used in learning mode The default value for n is 1...
std::unique_ptr< MissCache > fMissCache
! Cache contents for misses
Long64_t fCurrentClusterStart
! Start of the cluster(s) where the current content was picked out
virtual Int_t SetBufferSize(Int_t buffersize)
Sets the buffer size.
virtual Bool_t FillBuffer()
Fill the cache buffer with the branches in the cache.
Bool_t HasBeenUsed(Int_t basketNumber) const
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
void SetIsInCache(Int_t basketNumber)
Int_t fNReadPref
Number of blocks that were prefetched.
A Branch for the case of an object.
virtual Long64_t GetBasketSeek(Int_t basket) const
Return address of basket in the file.
void SetUsed(Int_t basketNumber)
void SetOptimizeMisses(Bool_t opt)
Start of methods for the miss cache.
Bool_t fReverseRead
! reading in reverse mode
virtual void UpdateBranchIndices(TObjArray *branches)=0
Bool_t fFirstTime
! save the fact that we processes the first entry
Long64_t fEntryCurrent
! current lowest entry number in the cache
Int_t fBufferSizeMin
Original size of fBuffer.
Long64_t Next()
Move on to the next cluster and return the starting entry of this next cluster.
TObject * UncheckedAt(Int_t i) const
TTreeCache()
Default Constructor.
virtual void Print(Option_t *option="") const
Print cache statistics.
Bool_t fIsLearning
! true if cache is in learning mode
virtual Int_t GetTreeNumber() const
virtual Int_t GetBufferSize() const
unsigned long long ULong64_t
void ResetMissCache()
Reset all the miss cache training.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void SetFile(TFile *file, TFile::ECacheAction action=TFile::kDisconnect)
Overload to make sure that the object specific.
static constexpr double s
Int_t fNMissReadOk
Number of blocks read, not found in the primary cache, and found in the secondary cache...
EPrefillType fPrefillType
Whether a pre-filling is enabled (and if applicable which type)
Long64_t fFirstMiss
! set to the event # of the first miss.
Int_t fFillTimes
! how many times we can fill the current buffer
virtual Int_t SetBufferSize(Int_t buffersize)
Change the underlying buffer size of the cache.
virtual Long64_t GetEntries() const
Int_t fNbranches
! Number of branches in the cache
Bool_t fEnablePrefetching
reading by prefetching asynchronously
Bool_t ProcessMiss(Long64_t pos, int len)
! Given a file read not in the miss cache, handle (possibly) loading the data.
virtual void Add(TObject *obj)
Long64_t fFirstEntry
! save the value of the first entry
virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read the nbuf blocks described in arrays pos and len.
A TFriendElement TF describes a TTree object TF in a file.
A chain is a collection of files containing TTree objects.
TList * fBrNames
! list of branch names in the cache
Long64_t GetReadEntry() const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Bool_t fFirstBuffer
! true if first buffer is used for prefetching
static Int_t fgLearnEntries
number of entries used for learning mode
Double_t GetMissEfficiency() const
The total efficiency of the 'miss cache' - defined as the ratio of blocks found in the cache versus t...
Int_t GetEntries() const
Return the number of objects in array (i.e.
void GetUnused(std::vector< Int_t > &unused)
Int_t Atoi() const
Return integer value of string.
virtual Int_t ReadBuffer(char *buf, Long64_t pos, Int_t len)
Read buffer at position pos.
A TTree object has a header with a name and a title.
TEventList * GetEventList() const
TBranch * GetBranch() const
Bool_t fIsManual
! true if cache is StopLearningPhase was used
virtual const char * GetName() const
Returns name of object.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
A TTree is a list of TBranches.
Long64_t fEntryNext
! next entry number where cache must be filled
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual void UpdateBranches(TTree *tree)
Update pointer to current Tree and recompute pointers to the branches in the cache.
Long64_t BinarySearch(Long64_t n, const T *array, T value)
Binary search in an array of n values to locate value.
Double_t GetEfficiency() const
Give the total efficiency of the primary cache...
TBranch * GetMother() const
Get our top-level parent branch in the tree.
static Int_t GetLearnEntries()
Static function returning the number of entries used to train the cache see SetLearnEntries.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Int_t fNseek
Number of blocks to be prefetched.
virtual TObjArray * GetListOfLeaves()
const char * Data() const
ECacheAction
TTreeCache flushing semantics.