2008-01-12 21:41:35 +03:00
|
|
|
#ifndef KERNEL_UTIL_TRACING_H
|
|
|
|
#define KERNEL_UTIL_TRACING_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
2008-01-13 02:55:53 +03:00
|
|
|
#include <KernelExport.h>
|
2008-01-12 21:41:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
#define ENABLE_TRACING 0
|
|
|
|
#define MAX_TRACE_SIZE 1024 * 1024
|
|
|
|
|
|
|
|
struct trace_entry {
|
|
|
|
uint16 size;
|
|
|
|
uint16 flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
#include <new>
|
|
|
|
|
|
|
|
class TraceEntry : trace_entry {
|
|
|
|
public:
|
|
|
|
TraceEntry();
|
|
|
|
virtual ~TraceEntry();
|
|
|
|
|
|
|
|
virtual void Dump();
|
|
|
|
|
|
|
|
size_t Size() const { return size; }
|
|
|
|
uint16 Flags() const { return flags; }
|
|
|
|
|
|
|
|
void Initialized();
|
|
|
|
|
2008-01-13 02:55:53 +03:00
|
|
|
void* operator new(size_t size, const std::nothrow_t&) throw();
|
|
|
|
};
|
|
|
|
|
|
|
|
class AbstractTraceEntry : public TraceEntry {
|
|
|
|
public:
|
|
|
|
AbstractTraceEntry()
|
|
|
|
:
|
|
|
|
fThread(find_thread(NULL)),
|
|
|
|
fTime(system_time())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Dump()
|
|
|
|
{
|
|
|
|
kprintf("[%6ld] %Ld: ", fThread, fTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
thread_id Thread() const { return fThread; }
|
|
|
|
bigtime_t Time() const { return fTime; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
thread_id fThread;
|
|
|
|
bigtime_t fTime;
|
2008-01-12 21:41:35 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
#endif
|
|
|
|
status_t tracing_init(void);
|
|
|
|
|
|
|
|
#endif /* KERNEL_UTIL_TRACING_H */
|