qemu-e2k/trace/simple.h

53 lines
1.3 KiB
C
Raw Normal View History

/*
* Simple trace backend
*
* Copyright IBM, Corp. 2010
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
*/
#ifndef TRACE_SIMPLE_H
#define TRACE_SIMPLE_H
void st_print_trace_file_status(void);
bool st_set_trace_file_enabled(bool enable);
void st_set_trace_file(const char *file);
bool st_init(void);
void st_init_group(size_t group);
trace: Add trace-file command to open/close/flush trace file This patch adds the trace-file command: trace-file [on|off|flush] Open, close, or flush the trace file. If no argument is given, the status of the trace file is displayed. The trace file is turned on by default but is only written out when the trace buffer becomes full. The flush operation can be used to force write out at any time. Turning off the trace file does not change the state of trace events; tracing will continue to the trace buffer. When the trace file is off, use "info trace" to display the contents of the trace buffer in memory. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> This commit also contains the trace-file sub-command from the following commit: commit 5ce8d1a957afae2c52ad748944ce72848ccf57bd Author: Prerna Saxena <prerna@linux.vnet.ibm.com> Date: Wed Aug 4 16:23:54 2010 +0530 trace: Add options to specify trace file name at startup and runtime This patch adds an optional command line switch '-trace' to specify the filename to write traces to, when qemu starts. Eg, If compiled with the 'simple' trace backend, [temp@system]$ qemu -trace FILENAME IMAGE Allows the binary traces to be written to FILENAME instead of the option set at config-time. Also, this adds monitor sub-command 'set' to trace-file commands to dynamically change trace log file at runtime. Eg, (qemu)trace-file set FILENAME This allows one to set trace outputs to FILENAME from the default specified at startup. Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-07-13 10:26:33 +02:00
void st_flush_trace_buffer(void);
typedef struct {
unsigned int tbuf_idx;
unsigned int rec_off;
} TraceBufferRecord;
/* Note for hackers: Make sure MAX_TRACE_LEN < sizeof(uint32_t) */
#define MAX_TRACE_STRLEN 512
/**
* Initialize a trace record and claim space for it in the buffer
*
* @arglen number of bytes required for arguments
*/
int trace_record_start(TraceBufferRecord *rec, uint32_t id, size_t arglen);
/**
* Append a 64-bit argument to a trace record
*/
void trace_record_write_u64(TraceBufferRecord *rec, uint64_t val);
/**
* Append a string argument to a trace record
*/
void trace_record_write_str(TraceBufferRecord *rec, const char *s, uint32_t slen);
/**
* Mark a trace record completed
*
* Don't append any more arguments to the trace record after calling this.
*/
void trace_record_finish(TraceBufferRecord *rec);
#endif /* TRACE_SIMPLE_H */