13 #ifndef ROOT_TTreeCacheUnzip
14 #define ROOT_TTreeCacheUnzip
29 namespace Experimental {
35 class TTreeCacheUnzip :
public TTreeCache {
40 enum EParUnzipMode { kEnable, kDisable, kForce };
43 enum EUnzipState { kUntouched, kProgress, kFinished };
51 std::unique_ptr<char[]> *fUnzipChunks;
52 std::vector<Int_t> fUnzipLen;
53 std::atomic<Byte_t> *fUnzipStatus;
56 fUnzipChunks =
nullptr;
57 fUnzipStatus =
nullptr;
60 if (fUnzipChunks)
delete [] fUnzipChunks;
61 if (fUnzipStatus)
delete [] fUnzipStatus;
63 void Clear(Int_t size);
64 Bool_t IsUntouched(Int_t index)
const;
65 Bool_t IsProgress(Int_t index)
const;
66 Bool_t IsFinished(Int_t index)
const;
67 Bool_t IsUnzipped(Int_t index)
const;
68 void Reset(Int_t oldSize, Int_t newSize);
69 void SetUntouched(Int_t index);
70 void SetProgress(Int_t index);
71 void SetFinished(Int_t index);
72 void SetMissed(Int_t index);
73 void SetUnzipped(Int_t index,
char* buf, Int_t len);
74 Bool_t TryUnzipping(Int_t index);
77 typedef struct UnzipState UnzipState_t;
78 UnzipState_t fUnzipState;
86 std::unique_ptr<TMutex> fIOMutex;
88 static TTreeCacheUnzip::EParUnzipMode fgParallel;
92 std::unique_ptr<ROOT::Experimental::TTaskGroup> fUnzipTaskGroup;
97 Int_t fUnzipGroupSize;
98 Long64_t fUnzipBufferSize;
100 static Double_t fgRelBuffSize;
109 TTreeCacheUnzip(
const TTreeCacheUnzip &);
110 TTreeCacheUnzip& operator=(
const TTreeCacheUnzip &);
113 Int_t fCompBufferSize;
120 TTreeCacheUnzip(TTree *tree, Int_t buffersize=0);
121 virtual ~TTreeCacheUnzip();
123 virtual Int_t AddBranch(TBranch *b, Bool_t subbranches = kFALSE);
124 virtual Int_t AddBranch(
const char *branch, Bool_t subbranches = kFALSE);
126 virtual Int_t ReadBufferExt(
char *buf, Long64_t pos, Int_t len, Int_t &loc);
127 void SetEntryRange(Long64_t emin, Long64_t emax);
128 virtual void StopLearningPhase();
129 void UpdateBranches(TTree *tree);
132 static EParUnzipMode GetParallelUnzip();
133 static Bool_t IsParallelUnzip();
134 static Int_t SetParallelUnzip(TTreeCacheUnzip::EParUnzipMode option = TTreeCacheUnzip::kEnable);
140 Int_t GetRecordHeader(
char *buf, Int_t maxbytes, Int_t &nbytes, Int_t &objlen, Int_t &keylen);
141 virtual Int_t GetUnzipBuffer(
char **buf, Long64_t pos, Int_t len, Bool_t *free);
142 Int_t GetUnzipGroupSize() {
return fUnzipGroupSize; }
143 virtual void ResetCache();
144 virtual Int_t SetBufferSize(Int_t buffersize);
145 void SetUnzipBufferSize(Long64_t bufferSize);
146 void SetUnzipGroupSize(Int_t groupSize) { fUnzipGroupSize = groupSize; }
147 static void SetUnzipRelBufferSize(Float_t relbufferSize);
148 Int_t UnzipBuffer(
char **dest,
char *src);
149 Int_t UnzipCache(Int_t index);
152 Int_t GetNUnzip() {
return fNUnzip; }
153 Int_t GetNMissed(){
return fNMissed; }
154 Int_t GetNFound() {
return fNFound; }
156 void Print(Option_t* option =
"")
const;
159 ClassDef(TTreeCacheUnzip,0)