Skip to content

Commit 68db0c3

Browse files
committed
Add QNX Probes config
Copy the QNX Probes proto configuration so traced_qnx_probes can be used with the main perfetto project. This has been tested as working with traced_qnx_probes build from QNX repo and traced + perfetto build from this project As part of this commit all changes in order to get Perfetto compiling on QNX were ported. These changes allow for building on QNX7.1 and QNX8.0 The changes are as listed - Fix the toolchain to not specify a gcc version as QNX7.1 and QNX8.0 differ - Disable no-stringop-overflow for is_gcc in upd - in perfetto_cmd.cc prealloc vector to avoid -Warray-bounds for emplaced string this change won't affect the behaviour of the code but remove the error. - Add x86_64 support for QNX cross compiling. - Fix getpeereid to no longer take a NULL gid, this is because the change from iopkt to io-sock removes the ability to ignore NULL input args. No functional for iopkt but will fix segfault in libsocket for io-sock platforms.
1 parent 6573367 commit 68db0c3

File tree

14 files changed

+511
-3
lines changed

14 files changed

+511
-3
lines changed

Android.bp

Lines changed: 245 additions & 0 deletions
Large diffs are not rendered by default.

BUILD

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ perfetto_cc_library(
230230
":protos_perfetto_config_process_stats_zero",
231231
":protos_perfetto_config_profiling_cpp",
232232
":protos_perfetto_config_profiling_zero",
233+
":protos_perfetto_config_qnx_cpp",
234+
":protos_perfetto_config_qnx_zero",
233235
":protos_perfetto_config_statsd_cpp",
234236
":protos_perfetto_config_statsd_zero",
235237
":protos_perfetto_config_sys_stats_cpp",
@@ -303,6 +305,7 @@ perfetto_cc_binary(
303305
":protos_perfetto_config_priority_boost_cpp",
304306
":protos_perfetto_config_process_stats_cpp",
305307
":protos_perfetto_config_profiling_cpp",
308+
":protos_perfetto_config_qnx_cpp",
306309
":protos_perfetto_config_statsd_cpp",
307310
":protos_perfetto_config_sys_stats_cpp",
308311
":protos_perfetto_config_system_info_cpp",
@@ -475,6 +478,7 @@ perfetto_cc_library(
475478
":protos_perfetto_config_priority_boost_zero",
476479
":protos_perfetto_config_process_stats_zero",
477480
":protos_perfetto_config_profiling_zero",
481+
":protos_perfetto_config_qnx_zero",
478482
":protos_perfetto_config_statsd_zero",
479483
":protos_perfetto_config_sys_stats_zero",
480484
":protos_perfetto_config_system_info_zero",
@@ -681,6 +685,7 @@ perfetto_cc_library(
681685
":protos_perfetto_config_priority_boost_zero",
682686
":protos_perfetto_config_process_stats_zero",
683687
":protos_perfetto_config_profiling_zero",
688+
":protos_perfetto_config_qnx_zero",
684689
":protos_perfetto_config_statsd_zero",
685690
":protos_perfetto_config_sys_stats_zero",
686691
":protos_perfetto_config_system_info_zero",
@@ -780,6 +785,7 @@ perfetto_cc_library(
780785
":protos_perfetto_config_priority_boost_zero",
781786
":protos_perfetto_config_process_stats_zero",
782787
":protos_perfetto_config_profiling_zero",
788+
":protos_perfetto_config_qnx_zero",
783789
":protos_perfetto_config_statsd_zero",
784790
":protos_perfetto_config_sys_stats_zero",
785791
":protos_perfetto_config_system_info_zero",
@@ -851,6 +857,8 @@ perfetto_cc_binary(
851857
":protos_perfetto_config_process_stats_zero",
852858
":protos_perfetto_config_profiling_cpp",
853859
":protos_perfetto_config_profiling_zero",
860+
":protos_perfetto_config_qnx_cpp",
861+
":protos_perfetto_config_qnx_zero",
854862
":protos_perfetto_config_statsd_cpp",
855863
":protos_perfetto_config_statsd_zero",
856864
":protos_perfetto_config_sys_stats_cpp",
@@ -982,6 +990,8 @@ perfetto_cc_library(
982990
":protos_perfetto_config_process_stats_zero",
983991
":protos_perfetto_config_profiling_cpp",
984992
":protos_perfetto_config_profiling_zero",
993+
":protos_perfetto_config_qnx_cpp",
994+
":protos_perfetto_config_qnx_zero",
985995
":protos_perfetto_config_statsd_cpp",
986996
":protos_perfetto_config_statsd_zero",
987997
":protos_perfetto_config_sys_stats_cpp",
@@ -5128,6 +5138,7 @@ perfetto_proto_library(
51285138
":protos_perfetto_config_process_stats_protos",
51295139
":protos_perfetto_config_profiling_protos",
51305140
":protos_perfetto_config_protos",
5141+
":protos_perfetto_config_qnx_protos",
51315142
":protos_perfetto_config_statsd_protos",
51325143
":protos_perfetto_config_sys_stats_protos",
51335144
":protos_perfetto_config_system_info_protos",
@@ -5207,6 +5218,7 @@ perfetto_proto_library(
52075218
":protos_perfetto_config_process_stats_protos",
52085219
":protos_perfetto_config_profiling_protos",
52095220
":protos_perfetto_config_protos",
5221+
":protos_perfetto_config_qnx_protos",
52105222
":protos_perfetto_config_statsd_protos",
52115223
":protos_perfetto_config_sys_stats_protos",
52125224
":protos_perfetto_config_system_info_protos",
@@ -5691,6 +5703,7 @@ perfetto_cc_library(
56915703
":protos_perfetto_config_priority_boost_zero_h",
56925704
":protos_perfetto_config_process_stats_zero_h",
56935705
":protos_perfetto_config_profiling_zero_h",
5706+
":protos_perfetto_config_qnx_zero_h",
56945707
":protos_perfetto_config_statsd_zero_h",
56955708
":protos_perfetto_config_sys_stats_zero_h",
56965709
":protos_perfetto_config_system_info_zero_h",
@@ -5731,6 +5744,7 @@ perfetto_cc_library(
57315744
":protos_perfetto_config_priority_boost_zero",
57325745
":protos_perfetto_config_process_stats_zero",
57335746
":protos_perfetto_config_profiling_zero",
5747+
":protos_perfetto_config_qnx_zero",
57345748
":protos_perfetto_config_statsd_zero",
57355749
":protos_perfetto_config_sys_stats_zero",
57365750
":protos_perfetto_config_system_info_zero",
@@ -5905,6 +5919,7 @@ perfetto_cc_protocpp_library(
59055919
":protos_perfetto_config_process_stats_cpp",
59065920
":protos_perfetto_config_profiling_cpp",
59075921
":protos_perfetto_config_protos",
5922+
":protos_perfetto_config_qnx_cpp",
59085923
":protos_perfetto_config_statsd_cpp",
59095924
":protos_perfetto_config_sys_stats_cpp",
59105925
":protos_perfetto_config_system_info_cpp",
@@ -6185,13 +6200,46 @@ perfetto_proto_library(
61856200
":protos_perfetto_config_priority_boost_protos",
61866201
":protos_perfetto_config_process_stats_protos",
61876202
":protos_perfetto_config_profiling_protos",
6203+
":protos_perfetto_config_qnx_protos",
61886204
":protos_perfetto_config_statsd_protos",
61896205
":protos_perfetto_config_sys_stats_protos",
61906206
":protos_perfetto_config_system_info_protos",
61916207
":protos_perfetto_config_track_event_protos",
61926208
],
61936209
)
61946210

6211+
# GN target: //protos/perfetto/config/qnx:cpp
6212+
perfetto_cc_protocpp_library(
6213+
name = "protos_perfetto_config_qnx_cpp",
6214+
deps = [
6215+
":protos_perfetto_common_cpp",
6216+
":protos_perfetto_config_qnx_protos",
6217+
],
6218+
)
6219+
6220+
# GN target: //protos/perfetto/config/qnx:source_set
6221+
perfetto_proto_library(
6222+
name = "protos_perfetto_config_qnx_protos",
6223+
srcs = [
6224+
"protos/perfetto/config/qnx/qnx_config.proto",
6225+
],
6226+
visibility = [
6227+
PERFETTO_CONFIG.proto_library_visibility,
6228+
],
6229+
deps = [
6230+
":protos_perfetto_common_protos",
6231+
],
6232+
)
6233+
6234+
# GN target: //protos/perfetto/config/qnx:zero
6235+
perfetto_cc_protozero_library(
6236+
name = "protos_perfetto_config_qnx_zero",
6237+
deps = [
6238+
":protos_perfetto_common_zero",
6239+
":protos_perfetto_config_qnx_protos",
6240+
],
6241+
)
6242+
61956243
# GN target: //protos/perfetto/config/statsd:cpp
61966244
perfetto_cc_protocpp_library(
61976245
name = "protos_perfetto_config_statsd_cpp",
@@ -6322,6 +6370,7 @@ perfetto_cc_protozero_library(
63226370
":protos_perfetto_config_process_stats_zero",
63236371
":protos_perfetto_config_profiling_zero",
63246372
":protos_perfetto_config_protos",
6373+
":protos_perfetto_config_qnx_zero",
63256374
":protos_perfetto_config_statsd_zero",
63266375
":protos_perfetto_config_sys_stats_zero",
63276376
":protos_perfetto_config_system_info_zero",
@@ -6345,6 +6394,7 @@ perfetto_cc_protocpp_library(
63456394
":protos_perfetto_config_priority_boost_cpp",
63466395
":protos_perfetto_config_process_stats_cpp",
63476396
":protos_perfetto_config_profiling_cpp",
6397+
":protos_perfetto_config_qnx_cpp",
63486398
":protos_perfetto_config_statsd_cpp",
63496399
":protos_perfetto_config_sys_stats_cpp",
63506400
":protos_perfetto_config_system_info_cpp",
@@ -6369,6 +6419,7 @@ perfetto_cc_ipc_library(
63696419
":protos_perfetto_config_priority_boost_cpp",
63706420
":protos_perfetto_config_process_stats_cpp",
63716421
":protos_perfetto_config_profiling_cpp",
6422+
":protos_perfetto_config_qnx_cpp",
63726423
":protos_perfetto_config_statsd_cpp",
63736424
":protos_perfetto_config_sys_stats_cpp",
63746425
":protos_perfetto_config_system_info_cpp",
@@ -6402,6 +6453,7 @@ perfetto_proto_library(
64026453
":protos_perfetto_config_process_stats_protos",
64036454
":protos_perfetto_config_profiling_protos",
64046455
":protos_perfetto_config_protos",
6456+
":protos_perfetto_config_qnx_protos",
64056457
":protos_perfetto_config_statsd_protos",
64066458
":protos_perfetto_config_sys_stats_protos",
64076459
":protos_perfetto_config_system_info_protos",
@@ -7164,6 +7216,7 @@ perfetto_proto_library(
71647216
":protos_perfetto_config_process_stats_protos",
71657217
":protos_perfetto_config_profiling_protos",
71667218
":protos_perfetto_config_protos",
7219+
":protos_perfetto_config_qnx_protos",
71677220
":protos_perfetto_config_statsd_protos",
71687221
":protos_perfetto_config_sys_stats_protos",
71697222
":protos_perfetto_config_system_info_protos",
@@ -7186,6 +7239,7 @@ perfetto_cc_protozero_library(
71867239
":protos_perfetto_config_priority_boost_zero",
71877240
":protos_perfetto_config_process_stats_zero",
71887241
":protos_perfetto_config_profiling_zero",
7242+
":protos_perfetto_config_qnx_zero",
71897243
":protos_perfetto_config_statsd_zero",
71907244
":protos_perfetto_config_sys_stats_zero",
71917245
":protos_perfetto_config_system_info_zero",
@@ -7226,6 +7280,7 @@ perfetto_proto_library(
72267280
":protos_perfetto_config_process_stats_protos",
72277281
":protos_perfetto_config_profiling_protos",
72287282
":protos_perfetto_config_protos",
7283+
":protos_perfetto_config_qnx_protos",
72297284
":protos_perfetto_config_statsd_protos",
72307285
":protos_perfetto_config_sys_stats_protos",
72317286
":protos_perfetto_config_system_info_protos",
@@ -7271,6 +7326,7 @@ perfetto_cc_protozero_library(
72717326
":protos_perfetto_config_priority_boost_zero",
72727327
":protos_perfetto_config_process_stats_zero",
72737328
":protos_perfetto_config_profiling_zero",
7329+
":protos_perfetto_config_qnx_zero",
72747330
":protos_perfetto_config_statsd_zero",
72757331
":protos_perfetto_config_sys_stats_zero",
72767332
":protos_perfetto_config_system_info_zero",
@@ -7441,6 +7497,7 @@ perfetto_proto_library(
74417497
":protos_perfetto_config_process_stats_protos",
74427498
":protos_perfetto_config_profiling_protos",
74437499
":protos_perfetto_config_protos",
7500+
":protos_perfetto_config_qnx_protos",
74447501
":protos_perfetto_config_statsd_protos",
74457502
":protos_perfetto_config_sys_stats_protos",
74467503
":protos_perfetto_config_system_info_protos",
@@ -7866,6 +7923,8 @@ perfetto_cc_library(
78667923
":protos_perfetto_config_process_stats_zero",
78677924
":protos_perfetto_config_profiling_cpp",
78687925
":protos_perfetto_config_profiling_zero",
7926+
":protos_perfetto_config_qnx_cpp",
7927+
":protos_perfetto_config_qnx_zero",
78697928
":protos_perfetto_config_statsd_cpp",
78707929
":protos_perfetto_config_statsd_zero",
78717930
":protos_perfetto_config_sys_stats_cpp",
@@ -7967,6 +8026,8 @@ perfetto_cc_binary(
79678026
":protos_perfetto_config_process_stats_zero",
79688027
":protos_perfetto_config_profiling_cpp",
79698028
":protos_perfetto_config_profiling_zero",
8029+
":protos_perfetto_config_qnx_cpp",
8030+
":protos_perfetto_config_qnx_zero",
79708031
":protos_perfetto_config_statsd_cpp",
79718032
":protos_perfetto_config_statsd_zero",
79728033
":protos_perfetto_config_sys_stats_cpp",
@@ -8147,6 +8208,7 @@ perfetto_cc_library(
81478208
":protos_perfetto_config_priority_boost_zero",
81488209
":protos_perfetto_config_process_stats_zero",
81498210
":protos_perfetto_config_profiling_zero",
8211+
":protos_perfetto_config_qnx_zero",
81508212
":protos_perfetto_config_statsd_zero",
81518213
":protos_perfetto_config_sys_stats_zero",
81528214
":protos_perfetto_config_system_info_zero",
@@ -8367,6 +8429,7 @@ perfetto_cc_binary(
83678429
":protos_perfetto_config_priority_boost_zero",
83688430
":protos_perfetto_config_process_stats_zero",
83698431
":protos_perfetto_config_profiling_zero",
8432+
":protos_perfetto_config_qnx_zero",
83708433
":protos_perfetto_config_statsd_zero",
83718434
":protos_perfetto_config_sys_stats_zero",
83728435
":protos_perfetto_config_system_info_zero",

buildtools/BUILD.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,12 @@ config("upb_config") {
587587
"protobuf/upb/reflection/stage0", # For pre-generated descriptor.upb.h
588588
"protobuf/third_party/utf8_range", # For utf8_range.h
589589
]
590+
if (is_gcc) {
591+
cflags = [
592+
"-Wno-stringop-overread",
593+
"-Wno-stringop-overflow",
594+
]
595+
}
590596
defines = [ "UPB_BOOTSTRAP_STAGE=0" ] # Use stage0 minitable functions
591597
}
592598

gn/standalone/toolchain/BUILD.gn

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ declare_args() {
152152
_target_triplet = "x86_64-linux-android"
153153
} else if (target_os == "qnx" && target_cpu == "arm64") {
154154
_target_triplet = "ntoaarch64"
155+
} else if (target_os == "qnx" && target_cpu == "x64") {
156+
_target_triplet = "ntox86_64"
155157
} else {
156158
assert(
157159
false,
@@ -194,10 +196,15 @@ declare_args() {
194196
target_strip = "$android_llvm_dir/bin/llvm-strip"
195197
} else if (is_qnx) {
196198
target_ar = "${_target_triplet}-ar"
197-
target_cc = "qcc -V8.3.0,gcc_${_target_triplet}le"
198-
target_cxx = "q++ -V8.3.0,gcc_${_target_triplet}le_cxx"
199199
target_linker = "${_target_triplet}-ld"
200200
target_strip = "${_target_triplet}-strip"
201+
if (target_cpu == "arm64") {
202+
target_cc = "qcc -Vgcc_${_target_triplet}le"
203+
target_cxx = "q++ -Vgcc_${_target_triplet}le_cxx"
204+
} else {
205+
target_cc = "qcc -Vgcc_${_target_triplet}"
206+
target_cxx = "q++ -Vgcc_${_target_triplet}_cxx"
207+
}
201208
} else {
202209
assert(_target_triplet != "",
203210
"target_triplet must be non-empty when cross-compiling")

include/perfetto/ext/base/sys_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#if !PERFETTO_BUILDFLAG(PERFETTO_COMPILER_GCC)
3131
// MinGW has these. clang-cl and MSVC, which use just the Windows SDK, don't.
3232
using uid_t = int;
33+
using gid_t = int;
3334
using pid_t = int;
3435
#endif // !GCC
3536

protos/perfetto/config/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ perfetto_proto_library("@TYPE@") {
3131
"priority_boost:@TYPE@",
3232
"process_stats:@TYPE@",
3333
"profiling:@TYPE@",
34+
"qnx:@TYPE@",
3435
"statsd:@TYPE@",
3536
"sys_stats:@TYPE@",
3637
"system_info:@TYPE@",

protos/perfetto/config/data_source_config.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import "protos/perfetto/config/test_config.proto";
5959
import "protos/perfetto/config/track_event/track_event_config.proto";
6060
import "protos/perfetto/config/system_info/system_info_config.proto";
6161
import "protos/perfetto/config/chrome/histogram_samples.proto";
62+
import "protos/perfetto/config/qnx/qnx_config.proto";
6263

6364
// The configuration that is passed to each data source when starting tracing.
6465
// Next id: 140
@@ -285,6 +286,9 @@ message DataSourceConfig {
285286
// Data source name: android.inputmethod
286287
optional InputMethodConfig inputmethod_config = 139 [lazy = true];
287288

289+
// Data source name: qnx.kernel
290+
optional QnxConfig qnx_config = 150 [lazy = true];
291+
288292
// This is a fallback mechanism to send a free-form text config to the
289293
// producer. In theory this should never be needed. All the code that
290294
// is part of the platform (i.e. traced service) is supposed to *not* truncate

protos/perfetto/config/perfetto_config.proto

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,6 +2381,38 @@ message PerfEventConfig {
23812381

23822382
// End of protos/perfetto/config/profiling/perf_event_config.proto
23832383

2384+
// Begin of protos/perfetto/config/qnx/qnx_config.proto
2385+
2386+
message QnxConfig {
2387+
// The number of buffers that tracelog will init for the QNX trace.
2388+
optional uint32 qnx_kernel_buffers = 1;
2389+
2390+
// The number of kernel buffers that tracelog will init for the QNX trace.
2391+
optional uint32 qnx_kernel_kbuffers = 2;
2392+
2393+
// Flag indicating whether the QNX kernel tracing should produce wide
2394+
// events which contain additional data or fast events which are most
2395+
// concise. In fast mode we lose the priority information
2396+
optional bool qnx_kernel_wide_events = 3;
2397+
2398+
// The number of pages initialized by default the parser's page cache.
2399+
optional uint32 qnx_cache_pages = 4;
2400+
2401+
// The max pages the page cache should allocate (must be at least as big)
2402+
// as the qnx_cache_pages value. Using -1 will allow the cache to grow
2403+
// unbounded. The cache will prefer to re-use existing pages so growth will
2404+
// only happen when needed (when parser is not keeping up).
2405+
optional int32 qnx_cache_max_pages = 5;
2406+
2407+
// The initial size of the the buffer used to hold the trace header values
2408+
// this dynamic buffer will grow as needed but reallocs can be avoided by
2409+
// selecting an initial size large enough to hold all the initial header
2410+
// data.
2411+
optional uint32 qnx_trace_buffer_init_bytes = 6;
2412+
}
2413+
2414+
// End of protos/perfetto/config/qnx/qnx_config.proto
2415+
23842416
// Begin of protos/perfetto/config/statsd/atom_ids.proto
23852417

23862418
// This enum is obtained by post-processing
@@ -4270,6 +4302,9 @@ message DataSourceConfig {
42704302
// Data source name: android.inputmethod
42714303
optional InputMethodConfig inputmethod_config = 139 [lazy = true];
42724304

4305+
// Data source name: qnx.kernel
4306+
optional QnxConfig qnx_config = 150 [lazy = true];
4307+
42734308
// This is a fallback mechanism to send a free-form text config to the
42744309
// producer. In theory this should never be needed. All the code that
42754310
// is part of the platform (i.e. traced service) is supposed to *not* truncate
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (C) 2019 The Android Open Source Project
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("../../../../gn/proto_library.gni")
16+
17+
perfetto_proto_library("@TYPE@") {
18+
deps = [ "../../common:@TYPE@" ]
19+
sources = [ "qnx_config.proto" ]
20+
}

0 commit comments

Comments
 (0)