fwRPC
 All Files Functions Variables
fwRPC_debug.ctl File Reference

Functions

bool fwRPC_dbg_enabled ()
 
void fwRPC_dbg_clear_events ()
 
void fwRPC_dbg_escalate (string module, int level)
 
void fwRPC_dbg_deescalate (string module, int level)
 
void fwRPC_dbg_hook (string identifier, string module, string callback)
 
void fwRPC_dbg_log (string type, anytype value)
 
void fwRPC_dbg_log_module (string module, string type, anytype value, bool force=false)
 
void fwRPC_dbg_unpack_event (string event, time &t, string &identifier, string &module, string &type, anytype &entry)
 
string fwRPC_dbg_pack_event (string t, string id, string module, string type, anytype entry)
 
void fwRPC_dbg_restartLocalCore ()
 
private void _set_dbg_level (string module, int level)
 
private int _get_dbg_level (string module)
 
private void _diag_hook_cb (string callback, string dp, int level)
 

Variables

private const string fwRPC_DBG_RESTART_TRIGGER_DPE = "_FwRPC_Diag/core.restartCore:_original.._value"
 
private global string g_fwRPC_debug_module
 
private global string g_fwRPC_debug_identifier
 
private global int g_fwRPC_debug_level = -1
 
const string fwRPC_DBG_DP = "_FwRPC_Diag/core"
 
const string fwRPC_DBG_MODULE_DPE = "_FwRPC_Diag/core.report_"
 
const string fwRPC_DBG_EVENTLIST_DPE = "_FwRPC_Diag/core.event_list"
 
const string fwRPC_DBG_FLAG = "fwRPC_DEBUG"
 
const string fwRPC_DBG_MODULE_CORE = "core"
 
const string fwRPC_DBG_MODULE_WORKER = "worker"
 
const string fwRPC_DBG_MODULE_CLIENT = "client"
 
const string fwRPC_DBG_MODULE_BROKER = "broker"
 
const string fwRPC_DBG_EVENT_GENERIC = "EV_GNRC"
 
const string fwRPC_DBG_EVENT_DUMP = "EV_DUMP"
 
const string fwRPC_DBG_EVENT_MSG = "EV_MESG"
 
const string fwRPC_DBG_EVENT_REQUEST = "EV_REQS"
 
const string fwRPC_DBG_EVENT_CHANGE = "EV_CHNG"
 
const string fwRPC_DBG_EVENT_ERROR = "EV_ERRO"
 
const string fwRPC_DBG_EVENT_WARNING = "EV_WARN"
 
const string fwRPC_DBG_EVENT_TEST = "EV_TEST"
 

Detailed Description

This module contains functionality for debugging fwRPC. Only one isolated usage of this file is permitted per module/identifier (as seen below) given the use of global variables.

Author
Victor Rodrigues (CERN, BE-ICS-SDS)

Function Documentation

void fwRPC_dbg_clear_events ( )

Clears all events.

TODO: do this on a per-module basis

void fwRPC_dbg_deescalate ( string  module,
int  level 
)

Deescalate the debug level for the given module.

Deescalating the level to 1 triggers a stauts dump of the specified module. Also disables forced debugging. Deescalating the level to 0 disables module status logging.

Parameters
module(IN, string) module to deescalate
level(IN, int) level to deescalate to
Returns
nothing
Exceptions
nothing
bool fwRPC_dbg_enabled ( )

Check whether debugging is enabled for this module.

Returns
true if enabled false otherwise
Exceptions
nothing
void fwRPC_dbg_escalate ( string  module,
int  level 
)

Escalate the debug level for the given module.

Escalating the level to 1 triggers a status dump of the specified module. Escalating the level to 2 forces debugging for the specified module. (useful for debugging).

If the current level is already over the requested level, the level will not be set, however, the module will still be triggered to log its status.

Parameters
module(IN, string) module to escalate
level(IN, int) level to escalate to
Returns
nothing
Exceptions
nothing
void fwRPC_dbg_hook ( string  identifier,
string  module,
string  callback 
)

Register a module.

This will set the identifier and module names, allowing the correct usage of fwRPC_dbg_log (in place of the explicit fwRPC_dbg_log_fwRPC_debug_module).

A callback is also registered to enable status polling from a debugging interface. When the debug level for this module is set to a value above 0, the callback is called.

Note that this should be done once per WCCOActrl manager or WCCOAui.

Parameters
identifier(IN, string) an identifier for the current module.
module(IN, string) the module name
callback(IN, string) name of function to be called in the event of a poll
Returns
nothing
Exceptions
nothing
void fwRPC_dbg_log ( string  type,
anytype  value 
)

Log an event.

Parameters
type(IN, string) type of event (fwRPC_DBG_EVENT_*)
value(IN, anytype) event data
Returns
nothing
Exceptions
nothing
void fwRPC_dbg_log_module ( string  module,
string  type,
anytype  value,
bool  force = false 
)

Log an event for a specific module name. Useful for tests.

Parameters
module(IN, string) module name override (fwRPC_DBG_MODULE_*)
type(IN, string) event type (fwRPC_DBG_EVENT_*)
value(IN, anytype) event data
force(IN, bool) force logging (useful for tests)
Returns
nothing
Exceptions
nothing
string fwRPC_dbg_pack_event ( string  t,
string  id,
string  module,
string  type,
anytype  entry 
)

Pack event data.

Parameters
t(IN, string) timestamp
id(IN, string) src identifier
module(IN, string) src module
type(IN, string) event type
entry(IN, string) entry data
Returns
serialized event
Exceptions
nothing
void fwRPC_dbg_restartLocalCore ( )

Initiate a core restart. Workers in the local system will be restarted as soon as possible, refreshing procedure definitions and scripts for future request executions.

Returns
nothing
Exceptions
nothing
void fwRPC_dbg_unpack_event ( string  event,
time &  t,
string &  identifier,
string &  module,
string &  type,
anytype &  entry 
)

Unpack event data.

Parameters
event(IN, string) event data to unpack
t(OUT, time) timestamp
identifier(OUT, string) src identifier
module(OUT, string) src module
type(OUT, string) event type
entry(OUT, anytype) entry data
Returns
nothing
Exceptions
nothing

Variable Documentation

const string fwRPC_DBG_EVENT_CHANGE = "EV_CHNG"

Debug message types

const string fwRPC_DBG_EVENT_DUMP = "EV_DUMP"

Debug message types

const string fwRPC_DBG_EVENT_ERROR = "EV_ERRO"

Debug message types

const string fwRPC_DBG_EVENT_GENERIC = "EV_GNRC"

Debug message types

const string fwRPC_DBG_EVENT_MSG = "EV_MESG"

Debug message types

const string fwRPC_DBG_EVENT_REQUEST = "EV_REQS"

Debug message types

const string fwRPC_DBG_EVENT_TEST = "EV_TEST"

Debug message types

const string fwRPC_DBG_EVENT_WARNING = "EV_WARN"

Debug message types

private global string g_fwRPC_debug_identifier

The identifier to be tagged in each event.

private global int g_fwRPC_debug_level = -1

The debug level. 1: Trigger status dump on set 2; Forced debug (ignores WCCOActrl manager dbg flags (useful for tests) Any other value: debug disabled

private global string g_fwRPC_debug_module

The module type of this debug instance to be tagged in each event.