diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2020-10-02 00:16:01 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2020-10-02 00:21:11 +0300 |
commit | edd1164575feefda103c73119a98cbd994e53141 (patch) | |
tree | ae69e078944ba7f27ffbce6209e4eef6e17fca88 /intern/cycles/render/stats.h | |
parent | 342bdbc1769fa31c734d7c38ab67be3428c9d234 (diff) |
Cycles: add time statistics to scene update
Gathers information for time spent in the various managers or object (Film, Camera, etc.) being updated in Scene::device_update.
The stats include the total time spent in the device_update methods as well as time spent in subroutines (e.g. bvh build, displacement, etc.).
This does not qualify as a full blown profiler, but is useful to identify potential bottleneck areas.
The stats can be enabled and printed by passing `--cycles-print-stats` on the command line to Cycles, or `-- --cycles-print-stats` to Blender.
Reviewed By: brecht
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D8596
Diffstat (limited to 'intern/cycles/render/stats.h')
-rw-r--r-- | intern/cycles/render/stats.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/intern/cycles/render/stats.h b/intern/cycles/render/stats.h index e45403a3754..5dca6dd0b01 100644 --- a/intern/cycles/render/stats.h +++ b/intern/cycles/render/stats.h @@ -41,6 +41,15 @@ class NamedSizeEntry { size_t size; }; +class NamedTimeEntry { + public: + NamedTimeEntry(); + NamedTimeEntry(const string &name, double time); + + string name; + double time; +}; + /* Container of named size entries. Used, for example, to store per-mesh memory * usage statistics. But also keeps track of overall memory usage of the * container. @@ -64,6 +73,29 @@ class NamedSizeStats { vector<NamedSizeEntry> entries; }; +class NamedTimeStats { + public: + NamedTimeStats(); + + /* Add entry to the statistics. */ + void add_entry(const NamedTimeEntry &entry) + { + total_time += entry.time; + entries.push_back(entry); + } + + /* Generate full human-readable report. */ + string full_report(int indent_level = 0); + + /* Total time of all entries. */ + double total_time; + + /* NOTE: Is fine to read directly, but for adding use add_entry(), which + * makes sure all accumulating values are properly updated. + */ + vector<NamedTimeEntry> entries; +}; + class NamedNestedSampleStats { public: NamedNestedSampleStats(); @@ -155,6 +187,38 @@ class RenderStats { NamedSampleCountStats objects; }; +class UpdateTimeStats { + public: + /* Generate full human-readable report. */ + string full_report(int indent_level = 0); + + NamedTimeStats times; +}; + +class SceneUpdateStats { + public: + SceneUpdateStats(); + + UpdateTimeStats geometry; + UpdateTimeStats image; + UpdateTimeStats light; + UpdateTimeStats object; + UpdateTimeStats background; + UpdateTimeStats bake; + UpdateTimeStats camera; + UpdateTimeStats film; + UpdateTimeStats integrator; + UpdateTimeStats osl; + UpdateTimeStats particles; + UpdateTimeStats scene; + UpdateTimeStats svm; + UpdateTimeStats tables; + + string full_report(); + + void clear(); +}; + CCL_NAMESPACE_END #endif /* __RENDER_STATS_H__ */ |