Skip to content

Commit 2c51e5a

Browse files
committed
Use sysconf to get the number of processors online for parallel processing of trace data
1 parent 14687fd commit 2c51e5a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/TraceStream.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ static SubstreamData substreams[TraceStream::SUBSTREAM_COUNT] = {
7070

7171
static const SubstreamData& substream(TraceStream::Substream s) {
7272
if (!substreams[TraceStream::RAW_DATA].threads) {
73-
substreams[TraceStream::RAW_DATA].threads = min(8, get_num_cpus());
73+
int cpus = sysconf(_SC_NPROCESSORS_ONLN);
74+
if (cpus < 1) {
75+
FATAL() << "sysconf failed";
76+
}
77+
substreams[TraceStream::RAW_DATA].threads = min(8, cpus);
7478
}
7579
return substreams[s];
7680
}

0 commit comments

Comments
 (0)