Unravel Engine C++ Reference
Loading...
Searching...
No Matches
batch_collector.cpp
Go to the documentation of this file.
1#include "batch_collector.h"
2
3#include <algorithm>
4#include <chrono>
5#include <iomanip>
6#include <sstream>
7
8namespace unravel
9{
10
24
26{
27 if(total_batches > 0)
28 {
29 average_batch_size = static_cast<float>(total_instances) / static_cast<float>(total_batches);
31 }
32 else
33 {
34 average_batch_size = 0.0f;
36 }
37
39}
40
41auto batch_stats::to_string() const -> std::string
42{
43 std::ostringstream oss;
44 oss << std::fixed << std::setprecision(2);
45 oss << "batch_stats{";
46 oss << "batches=" << total_batches;
47 oss << ", instances=" << total_instances;
48 oss << ", saved_calls=" << draw_calls_saved;
49 oss << ", efficiency=" << batching_efficiency;
50 oss << ", avg_size=" << average_batch_size;
51 oss << ", collection_time=" << collection_time_ms << "ms";
52 oss << ", prep_time=" << preparation_time_ms << "ms";
53 oss << ", memory=" << (instance_buffer_memory_used / 1024) << "KB";
54 if(split_batches > 0)
55 {
56 oss << ", splits=" << split_batches;
57 }
58 oss << "}";
59 return oss.str();
60}
61
62template class batch_collector_t<batch_key>;
64
65} // namespace unravel
Hash specialization for batch_key to enable use in std::unordered_map.
auto to_string() const -> std::string