Skip to content

Commit 631e840

Browse files
committed
Add sample id to csv file, and fix csv gen
Signed-off-by: Josh Minor <[email protected]>
1 parent 7bfade4 commit 631e840

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/model_instance/papi_profiler.cc

+8-9
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,24 @@ class PapiProfiler : public tflite::Profiler {
121121

122122
myfile.open(("counters_" + std::to_string(utc) + ".csv").c_str());
123123
// Header
124-
myfile << "op_id,thread_id,papi_event,value\n";
124+
myfile << "op_id,thread_id,sample_id,papi_event,value\n";
125125
// Iterate over map keyed on tflite operation id, with values being a vector
126126
// of counter values for each tracked perf event
127-
pid_t inf_thread_id;
128127
for (auto& event : results_) {
129-
// Write all of the per-core events first, broken down by thread
130128
for (uint64_t i = 0; i < event.second.size(); ++i) {
131-
inf_thread_id =
132-
inf_thread_ids_[i / papi_events_.size() % event_sets_.size()];
133-
myfile << event.first << "," << inf_thread_id << ","
129+
myfile << event.first << ","
130+
<< inf_thread_ids_[i / papi_events_.size() % event_sets_.size()]
131+
<< "," << i / papi_events_.size() << ","
134132
<< papi_events_[i % papi_events_.size()] << ","
135133
<< event.second[i] << "\n";
136134
}
137135
}
136+
138137
for (auto& event : results_uncore_) {
139138
// Now write the uncore events with a dummy thread id of -1
140139
for (uint64_t i = 0; i < results_uncore_[event.first].size(); ++i) {
141140
myfile << event.first << "," << -1 << ","
141+
<< i / papi_uncore_events_.size() << ","
142142
<< papi_uncore_events_[i % papi_uncore_events_.size()] << ","
143143
<< results_uncore_[event.first][i] << "\n";
144144
}
@@ -223,10 +223,9 @@ class PapiProfiler : public tflite::Profiler {
223223
results_[papi_regions_[event_handle]].insert(
224224
results_[papi_regions_[event_handle]].end(), event_values_.begin(),
225225
event_values_.end());
226+
// Push back the op timing
227+
results_[papi_regions_[event_handle]].push_back(op_latency);
226228
}
227-
228-
// Push back the op timing
229-
results_[papi_regions_[event_handle]].push_back(op_latency);
230229
}
231230
// Handle uncore events
232231
if (!papi_uncore_events_.empty()) {

0 commit comments

Comments
 (0)