Belle II Software  release-08-01-10
tmemread.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include "daq/dqm/DqmSharedMem.h"
10 
11 #include "TH1F.h"
12 #include "TMemFile.h"
13 
14 using namespace Belle2;
15 using namespace std;
16 
17 int main(int /*argc*/, char** /*argv*/)
18 {
19 
20  DqmSharedMem* shm = new DqmSharedMem("testhisto", 2000000);
21  char* buf = new char[8000000];
22 
23  for (;;) {
24  shm->lock();
25  memcpy(buf, shm->ptr(), 8000000);
26  shm->unlock();
27  TMemFile* file = new TMemFile("TestHisto", (char*)shm->ptr(), 2000000, "READ", "", 0);
28  file->ls();
29  file->Print();
30  TH1F* h1 = (TH1F*) file->Get("testhisto");
31  h1->Print();
32  sleep(1);
33  delete file;
34  }
35  // file->Write();
36  // file->Close();
37  return 0;
38 }
Abstract base class for different kinds of events.
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:91