This CL is a merge from the widevine repo of: http://go/wvgerrit/16491 Circular Buffer http://go/wvgerrit/16512 Circular Buffer Tests http://go/wvgerrit/16493 Entry Writer http://go/wvgerrit/16495 Profiled Scope http://go/wvgerrit/16500 Stats Collection http://go/wvgerrit/16543 Disallow Stats Copy or Assign http://go/wvgerrit/16514 Moving OEM Function Enum http://go/wvgerrit/16501 Defining Session Interface http://go/wvgerrit/16502 Session Definitions http://go/wvgerrit/16573 Remove code to num bytes table http://go/wvgerrit/16556 Connecting Profiler to Profiled Scope http://go/wvgerrit/16557 Android Reading Profiler History http://go/wvgerrit/16574 Adding Get Stats Method http://go/wvgerrit/16606 Seperating Session Parsing http://go/wvgerrit/16607 Adding get stats method to DRMPlugin http://go/wvgerrit/16608 Fixing Linux Build Failure http://go/wvgerrit/16612 Stop Clearing History http://go/wvgerrit/16613 Accessing profiler information using session id http://go/wvgerrit/16614 Making All Session Subsets of Global Session BUG: 25123303 BUG: 26027857 Change-Id: Ie2422e644aa631871852ea0e461695aeb7060f88
74 lines
1.5 KiB
C++
74 lines
1.5 KiB
C++
// Copyright 2016 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef WVCDM_PROFILER_SESSION_H_
|
|
#define WVCDM_PROFILER_SESSION_H_
|
|
|
|
#include <map>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <vector>
|
|
|
|
#include "circular_buffer.h"
|
|
#include "entry_writer.h"
|
|
#include "oem_functions.h"
|
|
#include "stats.h"
|
|
|
|
namespace wvcdm {
|
|
namespace oemprofiler {
|
|
|
|
class ProfilerSession {
|
|
|
|
public:
|
|
ProfilerSession();
|
|
|
|
void Submit(
|
|
OEM_FUNCTION fid,
|
|
uint64_t start_time,
|
|
uint64_t end_time,
|
|
const uint8_t* meta_data,
|
|
size_t meta_data_length);
|
|
|
|
// clear all samples and stats
|
|
void Clear();
|
|
|
|
void ReadHistory(std::vector<uint8_t>& output) const;
|
|
|
|
void ReadAllStats(std::vector<uint8_t>& output) const;
|
|
const Stat& ReadStat(OEM_FUNCTION fid) const;
|
|
|
|
static void Open(int64_t sid);
|
|
static void Close(int64_t sid);
|
|
|
|
static ProfilerSession* Find(int64_t sid);
|
|
|
|
private:
|
|
Stat stats_[OEM_FUNCTION_COUNT];
|
|
|
|
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;
|
|
|
|
ProfilerSession(const ProfilerSession&);
|
|
void operator=(const ProfilerSession&);
|
|
|
|
static uint8_t GetByte(uint64_t value, size_t byte_index);
|
|
|
|
static std::map<int64_t, ProfilerSession*> sessions_;
|
|
};
|
|
|
|
} // namespace oemprofiler
|
|
} // namespace wvcdm
|
|
|
|
#endif
|