071f9c3aa2
finally created a solution to avoid that: Header files that contain configuration settings (and nothing else) go to build/config_headers. To change settings, create a directory build/user_config_headers (which is ignored by svn), copy the respective header there and modify it at your leisure. Currently only tracing_config.h has been moved to the new location, but more files will follow eventually. It is also recommended to move optional macro definitions in Jamfile (as for BFS) to a config header instead; the build system will then automatically rebuild on changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24611 a95241bf-73f2-0310-859d-f6bbb57e9c96
110 lines
2.2 KiB
C++
110 lines
2.2 KiB
C++
#ifndef KERNEL_TRACING_H
|
|
#define KERNEL_TRACING_H
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
#include <KernelExport.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "tracing_config.h"
|
|
|
|
|
|
struct trace_entry {
|
|
uint32 size : 14; // actual size is *4
|
|
uint32 previous_size : 14; // actual size is *4
|
|
uint32 flags : 4;
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#include <new>
|
|
|
|
|
|
// trace output flags
|
|
#define TRACE_OUTPUT_TEAM_ID 0x01
|
|
// print the team ID
|
|
#define TRACE_OUTPUT_DIFF_TIME 0x02
|
|
// print the difference time to the previously printed entry instead of the
|
|
// absolute time
|
|
|
|
|
|
class TraceOutput {
|
|
public:
|
|
TraceOutput(char* buffer, size_t bufferSize, uint32 flags);
|
|
|
|
void Clear();
|
|
void Print(const char* format,...);
|
|
bool IsFull() const { return fSize >= fCapacity; }
|
|
|
|
char* Buffer() const { return fBuffer; }
|
|
size_t Capacity() const { return fCapacity; }
|
|
size_t Size() const { return fSize; }
|
|
|
|
uint32 Flags() const { return fFlags; }
|
|
|
|
void SetLastEntryTime(bigtime_t time);
|
|
bigtime_t LastEntryTime() const;
|
|
|
|
private:
|
|
char* fBuffer;
|
|
size_t fCapacity;
|
|
size_t fSize;
|
|
uint32 fFlags;
|
|
bigtime_t fLastEntryTime;
|
|
};
|
|
|
|
class TraceEntry : public trace_entry {
|
|
public:
|
|
TraceEntry();
|
|
virtual ~TraceEntry();
|
|
|
|
virtual void Dump(TraceOutput& out);
|
|
|
|
size_t Size() const { return size; }
|
|
uint16 Flags() const { return flags; }
|
|
|
|
void Initialized();
|
|
|
|
void* operator new(size_t size, const std::nothrow_t&) throw();
|
|
};
|
|
|
|
class AbstractTraceEntry : public TraceEntry {
|
|
public:
|
|
AbstractTraceEntry();
|
|
virtual ~AbstractTraceEntry();
|
|
|
|
virtual void Dump(TraceOutput& out);
|
|
|
|
virtual void AddDump(TraceOutput& out);
|
|
|
|
thread_id Thread() const { return fThread; }
|
|
thread_id Team() const { return fTeam; }
|
|
bigtime_t Time() const { return fTime; }
|
|
|
|
protected:
|
|
thread_id fThread;
|
|
team_id fTeam;
|
|
bigtime_t fTime;
|
|
};
|
|
|
|
#endif // __cplusplus
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
uint8* alloc_tracing_buffer(size_t size);
|
|
uint8* alloc_tracing_buffer_memcpy(const void* source, size_t size, bool user);
|
|
char* alloc_tracing_buffer_strcpy(const char* source, size_t maxSize,
|
|
bool user);
|
|
status_t tracing_init(void);
|
|
|
|
void _user_ktrace_output(const char *message);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* KERNEL_TRACING_H */
|