This change is a merge of the following changes: 1. Remove MultipleSessions (go/wvgerrit/16763) 2. Increase Memory Budget (go/wvgerrit/16764) 3. Fixing Possible Integer Overflow (go/wvgerrit/16765) 4. Creating Call Table (go/wvgerrit/16766) 5. Creating Call History (go/wvgerrit/16767) 6. Connecting Profiled Scope (go/wvgerrit/16768) 7. Adding Call Table Version Number (go/wvgerrit/16780) 8. Add Version Number to Call History (go/wvgerrit/16781) bug: 27157796 Change-Id: Ia3f088a1714f3f5b426fee6141daa4ea8d832cf4
50 lines
923 B
C++
50 lines
923 B
C++
// Copyright 2016 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef WVCDM_CALL_HISTORY_H_
|
|
#define WVCDM_CALL_HISTORY_H_
|
|
|
|
#include <stdint.h>
|
|
#include <vector>
|
|
|
|
#include "circular_buffer.h"
|
|
#include "oem_functions.h"
|
|
|
|
namespace wvcdm {
|
|
namespace oemprofiler {
|
|
|
|
class CallHistory {
|
|
|
|
public:
|
|
CallHistory();
|
|
|
|
void Write(
|
|
OEM_FUNCTION fid,
|
|
uint64_t start_time,
|
|
uint64_t end_time,
|
|
const uint8_t* meta_data,
|
|
size_t meta_data_length);
|
|
|
|
void Read(std::vector<uint8_t>& output) const;
|
|
|
|
private:
|
|
CircularBuffer buffer_;
|
|
|
|
uint64_t time_at_head_;
|
|
uint64_t time_at_tail_;
|
|
|
|
bool RequestSpace(uint8_t num_bytes);
|
|
|
|
bool ReadNextEntryRealEndTime(uint64_t* output);
|
|
|
|
bool DropLastEntry();
|
|
|
|
// Read a variable length value. This is the read that matches
|
|
// EntryWriter's WriteVLV.
|
|
int ReadVLV(size_t offset, uint64_t* output) const;
|
|
};
|
|
|
|
} // namespace oemprofiler
|
|
} // namespace wvcdm
|
|
|
|
#endif
|