1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © 2019-2020 Collabora, Ltd.
3bf215546Sopenharmony_ci * Author: Antonio Caggiano <antonio.caggiano@collabora.com>
4bf215546Sopenharmony_ci * Author: Robert Beckett <bob.beckett@collabora.com>
5bf215546Sopenharmony_ci * Author: Corentin Noël <corentin.noel@collabora.com>
6bf215546Sopenharmony_ci *
7bf215546Sopenharmony_ci * SPDX-License-Identifier: MIT
8bf215546Sopenharmony_ci */
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ci#include <cstdlib>
11bf215546Sopenharmony_ci
12bf215546Sopenharmony_ci#include "pps_datasource.h"
13bf215546Sopenharmony_ci
14bf215546Sopenharmony_ciint main(int argc, const char **argv)
15bf215546Sopenharmony_ci{
16bf215546Sopenharmony_ci   using namespace pps;
17bf215546Sopenharmony_ci
18bf215546Sopenharmony_ci   // Connects to the system tracing service
19bf215546Sopenharmony_ci   perfetto::TracingInitArgs args;
20bf215546Sopenharmony_ci   args.backends = perfetto::kSystemBackend;
21bf215546Sopenharmony_ci   perfetto::Tracing::Initialize(args);
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_ci   std::string driver_name =
24bf215546Sopenharmony_ci      (argc > 1) ? Driver::find_driver_name(argv[1]) : Driver::default_driver_name();
25bf215546Sopenharmony_ci   GpuDataSource::register_data_source(driver_name);
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci   while (true) {
28bf215546Sopenharmony_ci      GpuDataSource::wait_started();
29bf215546Sopenharmony_ci      GpuDataSource::Trace(GpuDataSource::trace_callback);
30bf215546Sopenharmony_ci   }
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci   return EXIT_SUCCESS;
33bf215546Sopenharmony_ci}
34