mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 20:20:18 +01:00
To be more consistent with other environment variables and ensure better scoping, all environment variables in utrace have now been prefixed with `MESA_`. Signed-off-by: Mark Collins <mark@igalia.com> Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Ack-by: Chia-I Wu <olvaffe@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18271>
32 lines
794 B
C++
32 lines
794 B
C++
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "c11/threads.h"
|
|
#include "util/perf/u_trace.h"
|
|
|
|
#define NUM_DEBUG_TEST_THREAD 8
|
|
|
|
static int
|
|
test_thread(void *_state)
|
|
{
|
|
struct u_trace_context ctx = {};
|
|
u_trace_context_init(&ctx, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
u_trace_context_fini(&ctx);
|
|
|
|
return 0;
|
|
}
|
|
|
|
TEST(UtilPerfTraceTest, Multithread)
|
|
{
|
|
static char env_tracefile[] = "MESA_GPU_TRACEFILE=tracefile_for_test-b5ba5a0c-6ed1-4901-a38d-755991182663";
|
|
thrd_t threads[NUM_DEBUG_TEST_THREAD];
|
|
putenv(env_tracefile);
|
|
for (unsigned i = 0; i < NUM_DEBUG_TEST_THREAD; i++) {
|
|
thrd_create(&threads[i], test_thread, NULL);
|
|
}
|
|
for (unsigned i = 0; i < NUM_DEBUG_TEST_THREAD; i++) {
|
|
int ret;
|
|
thrd_join(threads[i], &ret);
|
|
}
|
|
}
|