forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
system_tracing_common.cc
36 lines (27 loc) · 1005 Bytes
/
system_tracing_common.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/tracing/system_tracing_common.h"
#include <string.h>
#include "base/macros.h"
#include "base/trace_event/common/trace_event_common.h"
namespace chromecast {
namespace tracing {
namespace {
const char kSocketPath[] = "/dev/socket/tracing/tracing";
} // namespace
const char* const kCategories[] = {
"gfx", "input", TRACE_DISABLED_BY_DEFAULT("irq"),
"power", "sched", "workq"};
const size_t kCategoryCount = arraysize(kCategories);
sockaddr_un GetSystemTracingSocketAddress() {
struct sockaddr_un addr;
memset(&addr, 0, sizeof(addr));
static_assert(sizeof(kSocketPath) <= sizeof(addr.sun_path),
"Address too long");
strncpy(addr.sun_path, kSocketPath, sizeof(addr.sun_path) - 1);
addr.sun_family = AF_UNIX;
return addr;
}
} // namespace tracing
} // namespace chromecast