Lines Matching defs:utctx
75 struct u_trace_context *utctx;
143 chunk->utctx->delete_timestamp_buffer(chunk->utctx, chunk->timestamps);
205 chunk->utctx = ut->utctx;
206 chunk->timestamps = ut->utctx->create_timestamp_buffer(ut->utctx, TIMESTAMP_BUF_SIZE);
242 queue_init(struct u_trace_context *utctx)
244 if (utctx->queue.jobs)
247 bool ret = util_queue_init(&utctx->queue, "traceq", 256, 1,
253 utctx->out = NULL;
257 u_trace_context_init(struct u_trace_context *utctx,
265 utctx->pctx = pctx;
266 utctx->create_timestamp_buffer = create_timestamp_buffer;
267 utctx->delete_timestamp_buffer = delete_timestamp_buffer;
268 utctx->record_timestamp = record_timestamp;
269 utctx->read_timestamp = read_timestamp;
270 utctx->delete_flush_data = delete_flush_data;
272 utctx->last_time_ns = 0;
273 utctx->first_time_ns = 0;
274 utctx->frame_nr = 0;
276 list_inithead(&utctx->flushed_trace_chunks);
278 utctx->out = get_tracefile();
281 list_add(&utctx->node, &ctx_list);
284 if (!u_trace_context_tracing(utctx))
287 queue_init(utctx);
291 u_trace_context_fini(struct u_trace_context *utctx)
294 list_del(&utctx->node);
296 if (!utctx->queue.jobs)
298 util_queue_finish(&utctx->queue);
299 util_queue_destroy(&utctx->queue);
300 fflush(utctx->out);
301 free_chunks(&utctx->flushed_trace_chunks);
308 list_for_each_entry (struct u_trace_context, utctx, &ctx_list, node)
309 queue_init(utctx);
325 struct u_trace_context *utctx = chunk->utctx;
328 if (utctx->out && !utctx->last_time_ns) {
329 fprintf(utctx->out, "+----- NS -----+ +-- Δ --+ +----- MSG -----\n");
338 uint64_t ns = utctx->read_timestamp(utctx, chunk->timestamps, idx, chunk->flush_data);
341 if (!utctx->first_time_ns)
342 utctx->first_time_ns = ns;
345 delta = utctx->last_time_ns ? ns - utctx->last_time_ns : 0;
346 utctx->last_time_ns = ns;
351 ns = utctx->last_time_ns;
355 if (utctx->out) {
357 fprintf(utctx->out, "%016"PRIu64" %+9d: %s: ", ns, delta, evt->tp->name);
358 evt->tp->print(utctx->out, evt->payload);
360 fprintf(utctx->out, "%016"PRIu64" %+9d: %s\n", ns, delta, evt->tp->name);
365 evt->tp->perfetto(utctx->pctx, ns, chunk->flush_data, evt->payload);
371 if (utctx->out) {
372 uint64_t elapsed = utctx->last_time_ns - utctx->first_time_ns;
373 fprintf(utctx->out, "ELAPSED: %"PRIu64" ns\n", elapsed);
376 utctx->last_time_ns = 0;
377 utctx->first_time_ns = 0;
380 if (chunk->free_flush_data && utctx->delete_flush_data) {
381 utctx->delete_flush_data(utctx, chunk->flush_data);
384 if (utctx->out && chunk->eof) {
385 fprintf(utctx->out, "END OF FRAME %u\n", utctx->frame_nr++);
396 u_trace_context_process(struct u_trace_context *utctx, bool eof)
398 struct list_head *chunks = &utctx->flushed_trace_chunks;
416 util_queue_add_job(&utctx->queue, chunk, &chunk->fence,
424 u_trace_init(struct u_trace *ut, struct u_trace_context *utctx)
426 ut->utctx = utctx;
428 ut->enabled = u_trace_context_tracing(utctx);
497 copy_ts_buffer(begin_it.ut->utctx, cmdstream,
569 ut->utctx->record_timestamp(ut, cs, chunk->timestamps, chunk->num_traces);
596 list_splicetail(&ut->trace_chunks, &ut->utctx->flushed_trace_chunks);