Skip to content

Commit 017b22e

Browse files
dhoekwatercopybara-github
authored andcommitted
Add an interface for aggregating LBR data
PiperOrigin-RevId: 696608573
1 parent 8473a7b commit 017b22e

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

propeller/BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,20 @@ cc_library(
140140
],
141141
)
142142

143+
cc_library(
144+
name = "lbr_aggregator",
145+
hdrs = [
146+
"lbr_aggregator.h",
147+
],
148+
deps = [
149+
":binary_content",
150+
":lbr_aggregation",
151+
":propeller_options_cc_proto",
152+
":propeller_statistics",
153+
"@abseil-cpp//absl/status:statusor",
154+
],
155+
)
156+
143157
cc_library(
144158
name = "addr2cu",
145159
srcs = ["addr2cu.cc"],

propeller/lbr_aggregator.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef PROPELLER_LBR_AGGREGATOR_H_
2+
#define PROPELLER_LBR_AGGREGATOR_H_
3+
4+
#include "absl/status/statusor.h"
5+
#include "propeller/binary_content.h"
6+
#include "propeller/lbr_aggregation.h"
7+
#include "propeller/propeller_options.pb.h"
8+
#include "propeller/propeller_statistics.h"
9+
namespace propeller {
10+
// `LbrAggregator` is an abstraction around producing an `LbrAggregation`,
11+
// making the source of the aggregation (Perf data, memtrace, mock) opaque to
12+
// the user of the aggregation.
13+
class LbrAggregator {
14+
public:
15+
virtual ~LbrAggregator() = default;
16+
17+
// Returns an `LbrAggregation` for the specified binary according to the given
18+
// options, or an `absl::Status` if a valid aggregation can't be produced.
19+
//
20+
// `AggregateLbrData` can fail for various reasons, depending on the
21+
// implementation.
22+
virtual absl::StatusOr<LbrAggregation> AggregateLbrData(
23+
const PropellerOptions& options, const BinaryContent& binary_content,
24+
PropellerStats& stats) = 0;
25+
};
26+
27+
} // namespace propeller
28+
29+
#endif // PROPELLER_LBR_AGGREGATOR_H_

0 commit comments

Comments
 (0)