ruby: fold the debugging options into Debug.cc
This commit is contained in:
parent
6e8373fad6
commit
e1915f16d1
3 changed files with 42 additions and 35 deletions
|
@ -43,20 +43,31 @@ class Debug;
|
|||
extern Debug* g_debug_ptr;
|
||||
std::ostream * debug_cout_ptr;
|
||||
|
||||
// component character list
|
||||
const char DEFINE_COMP_CHAR[] =
|
||||
struct DebugComponentData
|
||||
{
|
||||
#undef DEFINE_COMP
|
||||
#define DEFINE_COMP(component, character, description) character,
|
||||
#include "Debug.def"
|
||||
const char *desc;
|
||||
const char ch;
|
||||
};
|
||||
|
||||
// component description list
|
||||
const char* DEFINE_COMP_DESCRIPTION[] =
|
||||
// component character list
|
||||
DebugComponentData debugComponents[] =
|
||||
{
|
||||
#undef DEFINE_COMP
|
||||
#define DEFINE_COMP(component, character, description) description,
|
||||
#include "Debug.def"
|
||||
{"System", 's' },
|
||||
{"Node", 'N' },
|
||||
{"Queue", 'q' },
|
||||
{"Event Queue", 'e' },
|
||||
{"Network", 'n' },
|
||||
{"Sequencer", 'S' },
|
||||
{"Tester", 't' },
|
||||
{"Generated", 'g' },
|
||||
{"SLICC", 'l' },
|
||||
{"Network Queues", 'Q' },
|
||||
{"Time", 'T' },
|
||||
{"Network Internals", 'i' },
|
||||
{"Store Buffer", 'b' },
|
||||
{"Cache", 'c' },
|
||||
{"Predictor", 'p' },
|
||||
{"Allocator", 'a' },
|
||||
};
|
||||
|
||||
extern "C" void changeDebugVerbosity(VerbosityLevel vb);
|
||||
|
@ -197,7 +208,7 @@ bool Debug::checkFilter(char ch)
|
|||
{
|
||||
for (int i=0; i<NUMBER_OF_COMPS; i++) {
|
||||
// Look at all components to find a character match
|
||||
if (DEFINE_COMP_CHAR[i] == ch) {
|
||||
if (debugComponents[i].ch == ch) {
|
||||
// We found a match - return no error
|
||||
return false; // no error
|
||||
}
|
||||
|
@ -263,9 +274,9 @@ bool Debug::addFilter(char ch)
|
|||
{
|
||||
for (int i=0; i<NUMBER_OF_COMPS; i++) {
|
||||
// Look at all components to find a character match
|
||||
if (DEFINE_COMP_CHAR[i] == ch) {
|
||||
if (debugComponents[i].ch == ch) {
|
||||
// We found a match - update the filter bit mask
|
||||
cout << " Debug: Adding to filter: '" << ch << "' (" << DEFINE_COMP_DESCRIPTION[i] << ")" << endl;
|
||||
cout << " Debug: Adding to filter: '" << ch << "' (" << debugComponents[i].desc << ")" << endl;
|
||||
m_filter |= (1 << i);
|
||||
return false; // no error
|
||||
}
|
||||
|
@ -291,7 +302,7 @@ void Debug::usageInstructions(void)
|
|||
{
|
||||
cerr << "Debug components: " << endl;
|
||||
for (int i=0; i<NUMBER_OF_COMPS; i++) {
|
||||
cerr << " " << DEFINE_COMP_CHAR[i] << ": " << DEFINE_COMP_DESCRIPTION[i] << endl;
|
||||
cerr << " " << debugComponents[i].ch << ": " << debugComponents[i].desc << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
DEFINE_COMP(SYSTEM_COMP, 's', "System")
|
||||
DEFINE_COMP(NODE_COMP, 'N', "Node")
|
||||
DEFINE_COMP(QUEUE_COMP, 'q', "Queue")
|
||||
DEFINE_COMP(EVENTQUEUE_COMP, 'e', "Event Queue")
|
||||
DEFINE_COMP(NETWORK_COMP, 'n', "Network")
|
||||
DEFINE_COMP(SEQUENCER_COMP, 'S', "Sequencer")
|
||||
DEFINE_COMP(TESTER_COMP, 't', "Tester")
|
||||
DEFINE_COMP(GENERATED_COMP, 'g', "Generated")
|
||||
DEFINE_COMP(SLICC_COMP, 'l', "SLICC")
|
||||
DEFINE_COMP(NETWORKQUEUE_COMP, 'Q', "Network Queues")
|
||||
DEFINE_COMP(TIME_COMP, 'T', "Time")
|
||||
DEFINE_COMP(NETWORK_INTERNALS_COMP, 'i', "Network Internals")
|
||||
DEFINE_COMP(STOREBUFFER_COMP, 'b', "Store Buffer")
|
||||
DEFINE_COMP(CACHE_COMP, 'c', "Cache")
|
||||
DEFINE_COMP(PREDICTOR_COMP, 'p', "Predictor")
|
||||
DEFINE_COMP(ALLOCATOR_COMP, 'a', "Allocator")
|
||||
|
|
@ -42,10 +42,23 @@ extern std::ostream * debug_cout_ptr;
|
|||
// component enumeration
|
||||
enum DebugComponents
|
||||
{
|
||||
#undef DEFINE_COMP
|
||||
#define DEFINE_COMP(component, character, description) component,
|
||||
#include "Debug.def"
|
||||
NUMBER_OF_COMPS
|
||||
SYSTEM_COMP,
|
||||
NODE_COMP,
|
||||
QUEUE_COMP,
|
||||
EVENTQUEUE_COMP,
|
||||
NETWORK_COMP,
|
||||
SEQUENCER_COMP,
|
||||
TESTER_COMP,
|
||||
GENERATED_COMP,
|
||||
SLICC_COMP,
|
||||
NETWORKQUEUE_COMP,
|
||||
TIME_COMP,
|
||||
NETWORK_INTERNALS_COMP,
|
||||
STOREBUFFER_COMP,
|
||||
CACHE_COMP,
|
||||
PREDICTOR_COMP,
|
||||
ALLOCATOR_COMP,
|
||||
NUMBER_OF_COMPS
|
||||
};
|
||||
|
||||
enum PriorityLevel {HighPrio, MedPrio, LowPrio};
|
||||
|
|
Loading…
Reference in a new issue