Add TraceEvent severity knob (#6326)
* add knob for trace event severity * add knob for TraceEvent severity * fix format * fix switch format * moved intToSeverity call inside __test initialization * updated knob name * fix line length format * fix format * git clang-format
This commit is contained in:
parent
65f2c14f31
commit
36c6e23700
|
@ -209,6 +209,7 @@ void FlowKnobs::initialize(Randomize randomize, IsSimulated isSimulated) {
|
|||
init( MAX_TRACE_EVENT_LENGTH, 4000 ); // If the value of this is changed, the corresponding default in Trace.cpp should be changed as well
|
||||
init( ALLOCATION_TRACING_ENABLED, true );
|
||||
init( SIM_SPEEDUP_AFTER_SECONDS, 450 );
|
||||
init( CODE_COV_TRACE_EVENT_SEVERITY, 10 ); // Code coverage TraceEvent severity level
|
||||
|
||||
//TDMetrics
|
||||
init( MAX_METRICS, 600 );
|
||||
|
|
|
@ -265,6 +265,7 @@ public:
|
|||
int MAX_TRACE_FIELD_LENGTH;
|
||||
int MAX_TRACE_EVENT_LENGTH;
|
||||
bool ALLOCATION_TRACING_ENABLED;
|
||||
int CODE_COV_TRACE_EVENT_SEVERITY;
|
||||
|
||||
// TDMetrics
|
||||
int64_t MAX_METRIC_SIZE;
|
||||
|
|
23
flow/Trace.h
23
flow/Trace.h
|
@ -64,6 +64,29 @@ enum Severity {
|
|||
SevMax = 1000000
|
||||
};
|
||||
|
||||
inline Severity intToSeverity(int sevnum) {
|
||||
switch (sevnum) {
|
||||
case 0:
|
||||
return SevVerbose;
|
||||
case 1:
|
||||
return SevSample;
|
||||
case 5:
|
||||
return SevDebug;
|
||||
case 10:
|
||||
return SevInfo;
|
||||
case 20:
|
||||
return SevWarn;
|
||||
case 30:
|
||||
return SevWarnAlways;
|
||||
case 40:
|
||||
return SevError;
|
||||
case 1000000:
|
||||
return SevMax;
|
||||
default:
|
||||
return SevInfo;
|
||||
}
|
||||
}
|
||||
|
||||
enum class ErrorKind : uint8_t {
|
||||
Unset,
|
||||
DiskIssue,
|
||||
|
|
|
@ -61,10 +61,11 @@
|
|||
#define TEST(condition) \
|
||||
if (!(condition)) { \
|
||||
} else { \
|
||||
static TraceEvent* __test = &(TraceEvent("CodeCoverage") \
|
||||
.detail("File", __FILE__) \
|
||||
.detail("Line", __LINE__) \
|
||||
.detail("Condition", #condition)); \
|
||||
static TraceEvent* __test = \
|
||||
&(TraceEvent(intToSeverity(FLOW_KNOBS->CODE_COV_TRACE_EVENT_SEVERITY), "CodeCoverage") \
|
||||
.detail("File", __FILE__) \
|
||||
.detail("Line", __LINE__) \
|
||||
.detail("Condition", #condition)); \
|
||||
(void)__test; \
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue