File tree Expand file tree Collapse file tree 2 files changed +42
-4
lines changed
backends/vulkan/runtime/vk_api Expand file tree Collapse file tree 2 files changed +42
-4
lines changed Original file line number Diff line number Diff line change @@ -233,9 +233,44 @@ std::string QueryPool::generate_string_report() {
233
233
return ss.str ();
234
234
}
235
235
236
- void QueryPool::print_results () {
236
+ std::string QueryPool::generate_tsv_string_report () {
237
+ std::lock_guard<std::mutex> lock (mutex_);
238
+
239
+ std::stringstream ss;
240
+
241
+ ss << " Kernel Name\t " ;
242
+ ss << " Global Workgroup Size\t " ;
243
+ ss << " Local Workgroup Size\t " ;
244
+ ss << " Duration (ns)\t " ;
245
+ ss << std::endl;
246
+
247
+ ss << " ===========\t " ;
248
+ ss << " =====================\t " ;
249
+ ss << " ====================\t " ;
250
+ ss << " =============\t " ;
251
+ ss << std::endl;
252
+
253
+ for (ShaderDuration& entry : shader_durations_) {
254
+ std::chrono::duration<size_t , std::nano> exec_duration_ns (
255
+ entry.execution_duration_ns );
256
+
257
+ ss << entry.kernel_name << " \t " ;
258
+ ss << stringize (entry.global_workgroup_size ) << " \t " ;
259
+ ss << stringize (entry.local_workgroup_size ) << " \t " ;
260
+ ss << exec_duration_ns.count () << " \t " ;
261
+ ss << std::endl;
262
+ }
263
+
264
+ return ss.str ();
265
+ }
266
+
267
+ void QueryPool::print_results (const bool tsv_format) {
237
268
EARLY_RETURN_IF_UNINITIALIZED ();
238
- std::cout << generate_string_report () << std::endl;
269
+ if (tsv_format) {
270
+ std::cout << generate_tsv_string_report () << std::endl;
271
+ } else {
272
+ std::cout << generate_string_report () << std::endl;
273
+ }
239
274
}
240
275
241
276
unsigned long QueryPool::get_total_shader_ns (std::string kernel_name) {
Original file line number Diff line number Diff line change @@ -99,14 +99,17 @@ class QueryPool final {
99
99
100
100
std::vector<std::tuple<std::string, uint32_t , uint64_t , uint64_t >>
101
101
get_shader_timestamp_data ();
102
- std::string generate_string_report ();
103
- void print_results ();
102
+ void print_results (const bool tsv_format = false );
104
103
unsigned long get_total_shader_ns (std::string kernel_name);
105
104
unsigned long get_mean_shader_ns (std::string kernel_name);
106
105
107
106
operator bool () const {
108
107
return querypool_ != VK_NULL_HANDLE;
109
108
}
109
+
110
+ private:
111
+ std::string generate_string_report ();
112
+ std::string generate_tsv_string_report ();
110
113
};
111
114
112
115
} // namespace vkapi
You can’t perform that action at this time.
0 commit comments