We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8267213 commit adde7a5Copy full SHA for adde7a5
src/common/cputrace.cc
@@ -47,7 +47,7 @@ int register_anchor(const char* name) {
47
48
struct read_format {
49
uint64_t nr;
50
- struct {
+ struct values {
51
uint64_t value;
52
uint64_t id;
53
} values[];
@@ -171,7 +171,11 @@ void HW_read(HW_ctx* ctx, sample_t* measure) {
171
if (ctx->parent_fd == -1) {
172
return;
173
}
174
- char buf[256];
+ static constexpr uint64_t MAX_COUNTERS = 5;
175
+ static constexpr size_t BUFFER_SIZE =
176
+ sizeof(read_format) + MAX_COUNTERS * sizeof(struct read_format::values);
177
+ char buf[BUFFER_SIZE];
178
+
179
struct read_format* rf = (struct read_format*)buf;
180
if (read(ctx->parent_fd, buf, sizeof(buf)) > 0) {
181
for (uint64_t i = 0; i < rf->nr; i++) {
0 commit comments