Skip to content

Commit

Permalink
Add an interface for aggregating LBR data
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696608573
  • Loading branch information
dhoekwater authored and copybara-github committed Nov 14, 2024
1 parent 8473a7b commit 017b22e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
14 changes: 14 additions & 0 deletions propeller/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ cc_library(
],
)

cc_library(
name = "lbr_aggregator",
hdrs = [
"lbr_aggregator.h",
],
deps = [
":binary_content",
":lbr_aggregation",
":propeller_options_cc_proto",
":propeller_statistics",
"@abseil-cpp//absl/status:statusor",
],
)

cc_library(
name = "addr2cu",
srcs = ["addr2cu.cc"],
Expand Down
29 changes: 29 additions & 0 deletions propeller/lbr_aggregator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef PROPELLER_LBR_AGGREGATOR_H_
#define PROPELLER_LBR_AGGREGATOR_H_

#include "absl/status/statusor.h"
#include "propeller/binary_content.h"
#include "propeller/lbr_aggregation.h"
#include "propeller/propeller_options.pb.h"
#include "propeller/propeller_statistics.h"
namespace propeller {
// `LbrAggregator` is an abstraction around producing an `LbrAggregation`,
// making the source of the aggregation (Perf data, memtrace, mock) opaque to
// the user of the aggregation.
class LbrAggregator {
public:
virtual ~LbrAggregator() = default;

// Returns an `LbrAggregation` for the specified binary according to the given
// options, or an `absl::Status` if a valid aggregation can't be produced.
//
// `AggregateLbrData` can fail for various reasons, depending on the
// implementation.
virtual absl::StatusOr<LbrAggregation> AggregateLbrData(
const PropellerOptions& options, const BinaryContent& binary_content,
PropellerStats& stats) = 0;
};

} // namespace propeller

#endif // PROPELLER_LBR_AGGREGATOR_H_

0 comments on commit 017b22e

Please sign in to comment.