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,45 @@ std::string QueryPool::generate_string_report() {
233
233
return ss.str ();
234
234
}
235
235
236
- void QueryPool::print_results () {
236
+
237
+ std::string QueryPool::generate_tsv_string_report () {
238
+ std::lock_guard<std::mutex> lock (mutex_);
239
+
240
+ std::stringstream ss;
241
+
242
+ ss << " Kernel Name\t " ;
243
+ ss << " Global Workgroup Size\t " ;
244
+ ss << " Local Workgroup Size\t " ;
245
+ ss << " Duration (ns)\t " ;
246
+ ss << std::endl;
247
+
248
+ ss << " ===========\t " ;
249
+ ss << " =====================\t " ;
250
+ ss << " ====================\t " ;
251
+ ss << " =============\t " ;
252
+ ss << std::endl;
253
+
254
+ for (ShaderDuration& entry : shader_durations_) {
255
+ std::chrono::duration<size_t , std::nano> exec_duration_ns (
256
+ entry.execution_duration_ns );
257
+
258
+ ss << entry.kernel_name << " \t " ;
259
+ ss << stringize (entry.global_workgroup_size ) << " \t " ;
260
+ ss << stringize (entry.local_workgroup_size ) << " \t " ;
261
+ ss << exec_duration_ns.count () << " \t " ;
262
+ ss << std::endl;
263
+ }
264
+
265
+ return ss.str ();
266
+ }
267
+
268
+ void QueryPool::print_results (const bool tsv_format) {
237
269
EARLY_RETURN_IF_UNINITIALIZED ();
238
- std::cout << generate_string_report () << std::endl;
270
+ if (tsv_format) {
271
+ std::cout << generate_tsv_string_report () << std::endl;
272
+ } else {
273
+ std::cout << generate_string_report () << std::endl;
274
+ }
239
275
}
240
276
241
277
unsigned long QueryPool::get_total_shader_ns (std::string kernel_name) {
Original file line number Diff line number Diff line change @@ -99,14 +99,16 @@ 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
+ private:
110
+ std::string generate_string_report ();
111
+ std::string generate_tsv_string_report ();
110
112
};
111
113
112
114
} // namespace vkapi
You can’t perform that action at this time.
0 commit comments