Added optional kernel tracing for sending BMessages. Currently only the

destination of the message and it's "what" field are stored. It might be
nice to also get some info about its fields -- maybe as an additional
option.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23810 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-02-01 12:35:00 +00:00
parent 0c6f7530ef
commit 90e3bbf0cb
2 changed files with 19 additions and 1 deletions

View File

@ -10,7 +10,7 @@
// tracing buffer size (in bytes)
#ifndef MAX_TRACE_SIZE
# define MAX_TRACE_SIZE 1024 * 1024
# define MAX_TRACE_SIZE (1024 * 1024)
#endif
@ -20,5 +20,6 @@
//#define SIGNAL_TRACING
//#define SYSCALL_TRACING
//#define TEAM_TRACING
//#define BMESSAGE_TRACING
#endif // KERNEL_TRACING_CONFIG_H

View File

@ -32,11 +32,20 @@
#include <stdlib.h>
#include <string.h>
#include <tracing_config.h>
// kernel tracing configuration
#define DEBUG_FUNCTION_ENTER //debug_printf("thread: 0x%x; this: 0x%08x; header: 0x%08x; fields: 0x%08x; data: 0x%08x; line: %04ld; func: %s\n", find_thread(NULL), this, fHeader, fFields, fData, __LINE__, __PRETTY_FUNCTION__);
#define DEBUG_FUNCTION_ENTER2 //debug_printf("thread: 0x%x; line: %04ld: func: %s\n", find_thread(NULL), __LINE__, __PRETTY_FUNCTION__);
#ifdef BMESSAGE_TRACING
# define KTRACE(format...) ktrace_printf(format)
#else
# define KTRACE(format...)
#endif
const char *B_SPECIFIER_ENTRY = "specifiers";
const char *B_PROPERTY_ENTRY = "property";
const char *B_PROPERTY_NAME_ENTRY = "name";
@ -1911,6 +1920,10 @@ BMessage::_SendMessage(port_id port, team_id portOwner, int32 token,
header->flags |= MESSAGE_FLAG_WAS_DELIVERED;
if (direct != NULL) {
KTRACE("BMessage send direct: port: %ld, token: %ld, "
"message: '%c%c%c%c'", port, token,
char(what >> 24), char(what >> 16), char(what >> 8), (char)what);
// this is a local message transmission
direct->AddMessage(copy);
@ -1921,6 +1934,10 @@ BMessage::_SendMessage(port_id port, team_id portOwner, int32 token,
direct->Release();
} else {
KTRACE("BMessage send remote: team: %ld, port: %ld, token: %ld, "
"message: '%c%c%c%c'", portOwner, port, token,
char(what >> 24), char(what >> 16), char(what >> 8), (char)what);
do {
result = write_port_etc(port, kPortMessageCode, (void *)buffer, size,
B_RELATIVE_TIMEOUT, timeout);