trace: add checkpoint event

genodelabs/genode#4352
This commit is contained in:
Johannes Schlatow 2021-12-01 18:42:52 +01:00 committed by Christian Helmuth
parent cf904e0a5d
commit 73dad70356
8 changed files with 70 additions and 16 deletions

View File

@ -25,6 +25,7 @@ namespace Genode { namespace Trace {
struct Rpc_reply; struct Rpc_reply;
struct Signal_submit; struct Signal_submit;
struct Signal_received; struct Signal_received;
struct Checkpoint;
} } } }
@ -121,4 +122,33 @@ struct Genode::Trace::Signal_received
}; };
struct Genode::Trace::Checkpoint
{
enum Type : unsigned char {
UNDEF = 0x0,
START = 0x1,
END = 0x2,
OBJ_NEW = 0x10,
OBJ_DEL = 0x11,
OBJ_STATE = 0x12,
EXCEPTION = 0xfe,
FAILURE = 0xff
};
char const *name;
unsigned long const data;
Type const type;
void *addr;
Checkpoint(char const *name, unsigned long data, void *addr, Type type=Type::UNDEF)
: name(name), data(data), type(type), addr(addr)
{
Thread::trace(this);
}
size_t generate(Policy_module &policy, char *dst) const {
return policy.checkpoint(dst, name, data, addr, type); }
};
#endif /* _INCLUDE__BASE__TRACE__EVENTS_H_ */ #endif /* _INCLUDE__BASE__TRACE__EVENTS_H_ */

View File

@ -32,6 +32,7 @@ namespace Genode {
struct Genode::Trace::Policy_module struct Genode::Trace::Policy_module
{ {
size_t (*max_event_size) (); size_t (*max_event_size) ();
size_t (*checkpoint) (char *, char const *, unsigned long, void *, unsigned char);
size_t (*log_output) (char *, char const *, size_t); size_t (*log_output) (char *, char const *, size_t);
size_t (*rpc_call) (char *, char const *, Msgbuf_base const &); size_t (*rpc_call) (char *, char const *, Msgbuf_base const &);
size_t (*rpc_returned) (char *, char const *, Msgbuf_base const &); size_t (*rpc_returned) (char *, char const *, Msgbuf_base const &);

View File

@ -22,6 +22,7 @@ namespace Genode {
} }
extern "C" size_t max_event_size (); extern "C" size_t max_event_size ();
extern "C" size_t checkpoint (char *dst, char const *name, unsigned long, void *, unsigned char);
extern "C" size_t log_output (char *dst, char const *log_message, size_t len); extern "C" size_t log_output (char *dst, char const *log_message, size_t len);
extern "C" size_t rpc_call (char *dst, char const *rpc_name, Genode::Msgbuf_base const &); extern "C" size_t rpc_call (char *dst, char const *rpc_name, Genode::Msgbuf_base const &);
extern "C" size_t rpc_returned (char *dst, char const *rpc_name, Genode::Msgbuf_base const &); extern "C" size_t rpc_returned (char *dst, char const *rpc_name, Genode::Msgbuf_base const &);

View File

@ -18,6 +18,12 @@ size_t max_event_size()
return MAX_EVENT_SIZE; return MAX_EVENT_SIZE;
} }
size_t checkpoint(char *dst, char const *, unsigned long, void *, unsigned char)
{
return div_zero();
}
size_t log_output(char *dst, char const *log_message, size_t len) size_t log_output(char *dst, char const *log_message, size_t len)
{ {
return div_zero(); return div_zero();

View File

@ -10,6 +10,11 @@ size_t max_event_size()
return MAX_EVENT_SIZE; return MAX_EVENT_SIZE;
} }
size_t checkpoint(char *dst, char const *, unsigned long, void *, unsigned char)
{
return 0;
}
size_t log_output(char *dst, char const *log_message, size_t len) size_t log_output(char *dst, char const *log_message, size_t len)
{ {
len = min(len, MAX_EVENT_SIZE); len = min(len, MAX_EVENT_SIZE);

View File

@ -7,6 +7,11 @@ size_t max_event_size()
return 0; return 0;
} }
size_t checkpoint(char *dst, char const *, unsigned long, void *, unsigned char)
{
return 0;
}
size_t log_output(char *dst, char const *log_message, size_t len) size_t log_output(char *dst, char const *log_message, size_t len)
{ {
return 0; return 0;

View File

@ -10,6 +10,11 @@ size_t max_event_size()
return MAX_EVENT_SIZE; return MAX_EVENT_SIZE;
} }
size_t checkpoint(char *, char const *, unsigned long, void *, unsigned char)
{
return 0;
}
size_t log_output(char *dst, char const *log_message, size_t len) size_t log_output(char *dst, char const *log_message, size_t len)
{ {
return 0; return 0;

View File

@ -19,6 +19,7 @@ extern "C" {
Genode::Trace::Policy_module policy_jump_table = Genode::Trace::Policy_module policy_jump_table =
{ {
max_event_size, max_event_size,
checkpoint,
log_output, log_output,
rpc_call, rpc_call,
rpc_returned, rpc_returned,