Skip to content

Commit

Permalink
Add dropped code review changes from google#2696
Browse files Browse the repository at this point in the history
- drop the magic window size constant and simply use Perfetto's default.
- Remove a TODO comment
  • Loading branch information
pmuetschard committed Apr 5, 2019
1 parent a492101 commit 6242020
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions gapis/perfetto/cc/processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ namespace pp = perfetto::protos;
// Callback back into go.
extern "C" void on_query_complete(int id, void* data, long unsigned int size);

processor new_processor(uint64_t window_size_ns) {
processor new_processor() {
ptp::Config config;
config.window_size_ns = window_size_ns;

return ptp::TraceProcessor::CreateInstance(config).release();
}

bool parse_data(processor processor, const void* data, size_t size) {
ptp::TraceProcessor* p = static_cast<ptp::TraceProcessor*>(processor);
// TODO: do we need this copy?
std::unique_ptr<uint8_t[]> buf(new uint8_t[size]);
memcpy(buf.get(), data, size);
if (!p->Parse(std::move(buf), size)) {
Expand Down
2 changes: 1 addition & 1 deletion gapis/perfetto/cc/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern "C" {

typedef void* processor;

processor new_processor(uint64_t window_size_ns);
processor new_processor();
bool parse_data(processor processor, const void* data, size_t size);
void execute_query(processor processor, int id, const char* query);
void delete_processor(processor processor);
Expand Down
2 changes: 1 addition & 1 deletion gapis/perfetto/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type Result struct {
}

func NewProcessor(ctx context.Context, data []byte) (*Processor, error) {
p := C.new_processor(60 * 1000 * 1000 * 1000)
p := C.new_processor()
log.D(ctx, "[perfetto] Parsing %d bytes", len(data))
if !C.parse_data(p, unsafe.Pointer(&data[0]), C.size_t(len(data))) {
log.W(ctx, "[perfetto] Parsing failed")
Expand Down

0 comments on commit 6242020

Please sign in to comment.