trace_processor: surface priority and end state information in sched tables
This allows to see why a process was descheduled and what priority it was
running at.
Bug: 122876520
Change-Id: Ia5bb0187d1baca830ce9bdc1d0af8aad81ebe2ab
diff --git a/src/trace_processor/trace_storage.h b/src/trace_processor/trace_storage.h
index f3a01e0..b688814 100644
--- a/src/trace_processor/trace_storage.h
+++ b/src/trace_processor/trace_storage.h
@@ -28,6 +28,7 @@
#include "perfetto/base/optional.h"
#include "perfetto/base/string_view.h"
#include "perfetto/base/utils.h"
+#include "src/trace_processor/ftrace_utils.h"
#include "src/trace_processor/stats.h"
namespace perfetto {
@@ -177,11 +178,15 @@
inline size_t AddSlice(uint32_t cpu,
int64_t start_ns,
int64_t duration_ns,
- UniqueTid utid) {
+ UniqueTid utid,
+ ftrace_utils::TaskState end_state,
+ int32_t priority) {
cpus_.emplace_back(cpu);
start_ns_.emplace_back(start_ns);
durations_.emplace_back(duration_ns);
utids_.emplace_back(utid);
+ end_states_.emplace_back(end_state);
+ priorities_.emplace_back(priority);
rows_for_utids_.emplace(utid, slice_count() - 1);
return slice_count() - 1;
}
@@ -190,6 +195,10 @@
durations_[index] = duration_ns;
}
+ void set_end_state(size_t index, ftrace_utils::TaskState end_state) {
+ end_states_[index] = end_state;
+ }
+
size_t slice_count() const { return start_ns_.size(); }
const std::deque<uint32_t>& cpus() const { return cpus_; }
@@ -200,6 +209,12 @@
const std::deque<UniqueTid>& utids() const { return utids_; }
+ const std::deque<ftrace_utils::TaskState>& end_state() const {
+ return end_states_;
+ }
+
+ const std::deque<int32_t>& priorities() const { return priorities_; }
+
const std::multimap<UniqueTid, uint32_t>& rows_for_utids() const {
return rows_for_utids_;
}
@@ -211,6 +226,8 @@
std::deque<int64_t> start_ns_;
std::deque<int64_t> durations_;
std::deque<UniqueTid> utids_;
+ std::deque<ftrace_utils::TaskState> end_states_;
+ std::deque<int32_t> priorities_;
std::multimap<UniqueTid, uint32_t> rows_for_utids_;
};