Reland "trace_processor: collapse sched slice table to a flat table"
This reverts commit c42c66b2dd053527068cab84c7af44df08b00475.
Change-Id: I5861c64e7be72248557d6fb1583e8d64779326fb
diff --git a/src/trace_processor/trace_storage.h b/src/trace_processor/trace_storage.h
index 47ccbf7..fb4e92c 100644
--- a/src/trace_processor/trace_storage.h
+++ b/src/trace_processor/trace_storage.h
@@ -78,11 +78,13 @@
uint32_t tid = 0;
};
- class SlicesPerCpu {
+ class Slices {
public:
- inline void AddSlice(uint64_t start_ns,
+ inline void AddSlice(uint32_t cpu,
+ uint64_t start_ns,
uint64_t duration_ns,
UniqueTid utid) {
+ cpus_.emplace_back(cpu);
start_ns_.emplace_back(start_ns);
durations_.emplace_back(duration_ns);
utids_.emplace_back(utid);
@@ -90,6 +92,8 @@
size_t slice_count() const { return start_ns_.size(); }
+ const std::deque<uint32_t>& cpus() const { return cpus_; }
+
const std::deque<uint64_t>& start_ns() const { return start_ns_; }
const std::deque<uint64_t>& durations() const { return durations_; }
@@ -99,6 +103,7 @@
private:
// Each deque below has the same number of entries (the number of slices
// in the trace for the CPU).
+ std::deque<uint32_t> cpus_;
std::deque<uint64_t> start_ns_;
std::deque<uint64_t> durations_;
std::deque<UniqueTid> utids_;
@@ -225,11 +230,6 @@
}
// Reading methods.
- const SlicesPerCpu& SlicesForCpu(uint32_t cpu) const {
- PERFETTO_DCHECK(cpu < cpu_events_.size());
- return cpu_events_[cpu];
- }
-
const std::string& GetString(StringId id) const {
PERFETTO_DCHECK(id < string_pool_.size());
return string_pool_[id];
@@ -246,6 +246,7 @@
return unique_threads_[utid];
}
+ const Slices& slices() const { return slices_; }
const NestableSlices& nestable_slices() const { return nestable_slices_; }
NestableSlices* mutable_nestable_slices() { return &nestable_slices_; }
@@ -272,7 +273,7 @@
Stats stats_;
// One entry for each CPU in the trace.
- std::array<SlicesPerCpu, base::kMaxCpus> cpu_events_;
+ Slices slices_;
// One entry for each unique string in the trace.
std::deque<std::string> string_pool_;