Lines Matching +full:- +full:- +full:enable +full:- +full:trace +full:- +full:backend
2 * Simple trace backend
7 * the COPYING file in the top-level directory.
16 #include "trace/control.h"
17 #include "trace/simple.h"
18 #include "qemu/error-report.h"
19 #include "qemu/qemu-print.h"
21 /** Trace file header event ID, picked to avoid conflict with real event IDs */
24 /** Trace file magic number */
27 /** Trace file version number, bump if format changes */
31 #define DROPPED_EVENT_ID (~(uint64_t)0 - 1)
33 /** Trace record is valid */
37 * Trace records are written out by a dedicated thread. The thread waits for
63 /* * Trace buffer entry */
94 * Read a trace record from the trace buffer
96 * @idx Trace buffer index
97 * @record Trace record to fill
119 (*recordptr)->event &= ~TRACE_RECORD_VALID; in get_trace_record()
120 /* clear the trace buffer range for consumed record otherwise any byte in get_trace_record()
188 unused = fwrite(recordptr, recordptr->length, 1, trace_fp); in writeout_thread()
189 writeout_idx += recordptr->length; in writeout_thread()
201 rec->rec_off = write_to_buffer(rec->rec_off, &val, sizeof(uint64_t)); in trace_record_write_u64()
207 rec->rec_off = write_to_buffer(rec->rec_off, &slen, sizeof(slen)); in trace_record_write_str()
209 rec->rec_off = write_to_buffer(rec->rec_off, (void*)s, slen); in trace_record_write_str()
224 if (new_idx - writeout_idx > TRACE_BUF_LEN) { in trace_record_start()
225 /* Trace Buffer Full, Event dropped ! */ in trace_record_start()
227 return -ENOSPC; in trace_record_start()
239 rec->tbuf_idx = idx; in trace_record_start()
240 rec->rec_off = (idx + sizeof(TraceRecord)) % TRACE_BUF_LEN; in trace_record_start()
272 read_from_buffer(rec->tbuf_idx, &record, sizeof(TraceRecord)); in trace_record_finish()
275 write_to_buffer(rec->tbuf_idx, &record, sizeof(TraceRecord)); in trace_record_finish()
277 if (((unsigned int)g_atomic_int_get(&trace_idx) - writeout_idx) in trace_record_finish()
296 return -1; in st_write_event_mapping()
304 * Enable / disable tracing, return whether it was enabled.
306 * @enable: enable if %true, else disable.
308 bool st_set_trace_file_enabled(bool enable) in st_set_trace_file_enabled() argument
313 if (enable == !!trace_fp) { in st_set_trace_file_enabled()
317 /* Halt trace writeout */ in st_set_trace_file_enabled()
322 if (enable) { in st_set_trace_file_enabled()
343 /* Resume trace writeout */ in st_set_trace_file_enabled()
354 * Set the name of a trace file
356 * @file The trace file name or NULL for the default name-<pid> set at
367 trace_file_name = g_strdup_printf(CONFIG_TRACE_FILE "-" FMT_pid, (pid_t)getpid()); in st_set_trace_file()
377 qemu_printf("Trace file \"%s\" %s.\n", in st_print_trace_file_status()
401 thread = g_thread_new("trace-thread", fn, NULL); in trace_thread_create()
418 warn_report("unable to initialize simple trace backend"); in st_init()