ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitCommon/OptIO/src/OptLoad.cc
Revision: 1.4
Committed: Wed Mar 4 07:24:50 2009 UTC (16 years, 2 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, V07-05-00, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, ConvRejection-10-06-09, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008, Mit_008pre2, HEAD
Branch point for: Mit_025c_branch
Changes since 1.3: +38 -31 lines
Log Message:
Check if preload is activated

File Contents

# User Rev Content
1 loizides 1.4 // $Id: OptLoad.cc,v 1.3 2009/02/26 16:18:07 loizides Exp $
2 loizides 1.1
3     #include "MitCommon/OptIO/interface/OptInt.h"
4 loizides 1.4 #include <Riostream.h>
5     #include <TEnv.h>
6     #include <TError.h>
7 loizides 1.1 #include <TROOT.h>
8 loizides 1.4 #include <TString.h>
9 loizides 1.1 #include <TSystem.h>
10 loizides 1.4
11 loizides 1.1
12     using namespace mithep;
13 loizides 1.4 extern int activated;
14 loizides 1.1
15     //--------------------------------------------------------------------------------------------------
16     namespace {
17     class OptIntLoad {
18     public:
19     OptIntLoad() {
20 loizides 1.4 TString mylib(gSystem->Getenv("LD_PRELOAD"));
21     if (mylib.Contains("MitCommonOptIO")) {
22     activated = 123;
23     Int_t verbose = gEnv->GetValue("Root.OptIO.Verbose",0);
24 loizides 1.3 if(verbose)
25 loizides 1.4 ::Info("OptIntLoad", "Loading libMitCommonOptIO.so for the optimized IO interface.");
26     Int_t zipmode = gEnv->GetValue("Root.ZipMode",-1);
27     if (zipmode>0) {
28     if(verbose)
29     ::Warning("OptIntLoad", "Setting ZipMode to %d as specified in rootrc", zipmode);
30     OptInt::SetZipMode(zipmode);
31     }
32     Double_t lzf = gEnv->GetValue("Root.OptIO.LzoFraction",1.);
33     Double_t gzf = gEnv->GetValue("Root.OptIO.GzipFraction",1.);
34     Double_t bzf = gEnv->GetValue("Root.OptIO.BzipFraction",1.);
35     Double_t lzm = gEnv->GetValue("Root.OptIO.LzmaFraction",1.);
36     if (lzf!=1 || gzf!= 1 || bzf!=1 || lzm!=1) {
37     if(verbose)
38     ::Warning("OptIntLoad", "Setting algo fractions to %.2f, %.2f, %.2f, %.2f"
39     " as specified in rootrc", lzf, gzf, bzf, lzm);
40     OptInt::SetAlgoFractions(lzf, gzf, bzf, lzm);
41     }
42     Int_t smalloc = gEnv->GetValue("Root.OptIO.SMalloc",0);
43     if (smalloc) {
44     if(verbose)
45     ::Warning("OptIntLoad", "Enabling static memory allocation as specified in rootrc");
46     OptInt::SetStaticMalloc(smalloc==1);
47     }
48     if (verbose) {
49     ::Warning("OptIntLoad", "Setting verbosity to %d as specified in rootrc", verbose);
50     OptInt::SetVerbose(verbose);
51     }
52 loizides 1.1 }
53     }
54     };
55     OptIntLoad dummy;
56     }