Comments (3)
I've located the problem (and proposed a fix):
In perf_to_profile_lib.cc
there exists this invocation:
return perftools::RawPerfDataToProfiles(data.data(), data.length()/* data.length() is a size_t */, {},
sample_labels, options);
The type of data.length()
or its alias data.size()
is size_t
. The problem lies within the perf_data_converter.cc
RawPerfDataToProfiles()
function which expects an integer for its raw_size
parameter. This causes integer narrowing/truncation in which no data can be read past INT_MAX (2147483647)
or ~2.14gb
.
See the changes below:
diff --git a/src/perf_data_converter.cc b/src/perf_data_converter.cc
index 2095e82..8775bd0 100644
--- a/src/perf_data_converter.cc
+++ b/src/perf_data_converter.cc
@@ -741,7 +741,7 @@ ProcessProfiles PerfDataProtoToProfiles(
}
ProcessProfiles RawPerfDataToProfiles(
- const void* raw, const int raw_size,
+ const void* raw, const uint64_t raw_size,
const std::map<string, string>& build_ids, const uint32 sample_labels,
const uint32 options, const std::map<Tid, string>& thread_types) {
quipper::PerfReader reader;
diff --git a/src/perf_data_converter.h b/src/perf_data_converter.h
index 8b12598..d94d53e 100644
--- a/src/perf_data_converter.h
+++ b/src/perf_data_converter.h
@@ -130,7 +130,7 @@ using ProcessProfiles = std::vector<std::unique_ptr<ProcessProfile>>;
//
// Returns a vector of process profiles, empty if any error occurs.
extern ProcessProfiles RawPerfDataToProfiles(
- const void* raw, int raw_size,
+ const void* raw, uint64_t raw_size,
const std::map<std::string, std::string>& build_ids,
uint32 sample_labels = kNoLabels, uint32 options = kGroupByPids,
const std::map<uint32, std::string>& thread_types = {});
I opted for uint64_t
as it is the widest integer type and is equivalent to size_t on 64-bit systems. I also identified instances elsewhere in the code base in which various size
metrics were of type u64
or uint64_t
(aliases). It makes sense to maintain some sense of consistency.
It should be noted that the current max protobuf size is 2gb. Currently, perf data is compressed (~80%) when it arrives in its final protobuf state which means this change is still worthwhile. The bottleneck is now the allowed max size of protobufs themselves. If the size of protobuf were to be increased then this change would become even more necessary. Currently, if we assume around 80% compression from perf data to profile data then our new maximum perf input size (assuming this change is implemented and there's a hard max of 2gb protobuf size) is ~10gb
.
from perf_data_converter.
It should be noted that the current max protobuf size is 2gb. Currently, perf data is compressed (~80%) when it arrives in its final protobuf state which means this change is still worthwhile. The bottleneck is now the allowed max size of protobufs themselves.
You're correct, this might not fix your problem if the data is way larger than the protobuf maximum. I'll submit a fix.
from perf_data_converter.
Merged #124
from perf_data_converter.
Related Issues (20)
- ERROR: Analysis of target '//src:perf_to_profile' failed; build aborted: error loading package '@com_google_protobuf//': Unable to find package for @rules_java//java:defs.bzl: The repository '@rules_java' could not be resolved. HOT 4
- Build fails with 404 errors because bazel doesn't follow redirects HOT 4
- Could we get a command-line option for setting `kPidAndTidLabels`? HOT 1
- "PERF_SAMPLE_REGS_USER is not yet supported" fatal error on perf.data recorded with `--call-graph dwarf` HOT 3
- Build broken due to bad dependencies import HOT 1
- fips_break_test.h: No such file or directory HOT 2
- build error in centos
- failed to compile in linux environment HOT 6
- should kernel addr-- ? HOT 1
- perf_to_profile crashes on a 3GB perf.data file HOT 3
- Modify .travis.yml to build quipper also with libc++ HOT 1
- Converter fails to parse perf.data files with PERF_SAMPLE_REGS_USER & PERF_SAMPLE_STACK_USER sample types. HOT 13
- "fatal error: 'byteswap.h' file not found" while building OSS quipper HOT 1
- How to change the boringssl repo to github?
- perf_to_profile drops perf symbols HOT 2
- Compiler warnings when building perf_data_converter HOT 1
- build failed with bazel 4.0, Arch Linux HOT 3
- Build failing "fips.c: No such file or directory" since 15.03.2021 (boringssl) HOT 3
- Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from perf_data_converter.