Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions core/foundation/inc/TError.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@

class TVirtualMutex;

constexpr Int_t kUnset = -1;
constexpr Int_t kPrint = 0;
constexpr Int_t kInfo = 1000;
constexpr Int_t kWarning = 2000;
constexpr Int_t kError = 3000;
constexpr Int_t kBreak = 4000;
constexpr Int_t kSysError = 5000;
constexpr Int_t kFatal = 6000;

R__EXTERN const Int_t kUnset;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can revert this commit: 3184f75 Do we need to make the constants out-of-line? That'd break performance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try with your suggestion, I will report the results from strace

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately that is not enough. Here are the numbers:

Patch of this PR:

$: strace -z -f -o log.txt -e trace=openat python3 -c 'import ROOT;print(ROOT.kError);'
$: 3000
$: grep openat log.txt | wc -l
$: 323

Revert of 3184f75

$: strace -z -f -o log.txt -e trace=openat python3 -c 'import ROOT;print(ROOT.kError);'
$: 3000
$: grep openat log.txt | wc -l
$: 13297

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really seems the discriminating factor is whether kError and other k* constants are present with symbols in libCore.so or not.

R__EXTERN const Int_t kPrint;
R__EXTERN const Int_t kInfo;
R__EXTERN const Int_t kWarning;
R__EXTERN const Int_t kError;
R__EXTERN const Int_t kBreak;
R__EXTERN const Int_t kSysError;
R__EXTERN const Int_t kFatal;

// TROOT sets the error ignore level handler, the system error message handler, and the error abort handler on
// construction such that the "Root.ErrorIgnoreLevel" environment variable is used for the ignore level
Expand Down
2 changes: 1 addition & 1 deletion core/foundation/src/RLogger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ inline bool RLogHandlerDefault::Emit(const RLogEntry &entry)
if (!entry.fLocation.fFuncName.empty())
strm << " in " << entry.fLocation.fFuncName;

static constexpr const int errorLevelOld[] = {kFatal /*unset*/, kFatal, kError, kWarning, kInfo, kInfo /*debug*/};
static const int errorLevelOld[] = {kFatal /*unset*/, kFatal, kError, kWarning, kInfo, kInfo /*debug*/};
(*::GetErrorHandler())(errorLevelOld[cappedLevel], entry.fLevel == ELogLevel::kFatal, strm.str().c_str(),
entry.fMessage.c_str());
return true;
Expand Down
9 changes: 9 additions & 0 deletions core/foundation/src/TError.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ to be replaced by the proper DefaultErrorHandler()
#include <cerrno>
#include <string>

const Int_t kUnset = -1;
const Int_t kPrint = 0;
const Int_t kInfo = 1000;
const Int_t kWarning = 2000;
const Int_t kError = 3000;
const Int_t kBreak = 4000;
const Int_t kSysError = 5000;
const Int_t kFatal = 6000;

Int_t gErrorIgnoreLevel = kUnset;
Int_t gErrorAbortLevel = kSysError+1;
Bool_t gPrintViaErrorHandler = kFALSE;
Expand Down