Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-07-27 16:46:13 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-07-27 18:19:54 +0300
commit84d47e3685c7ccfeaf2dd41ab64d1b642f157add (patch)
treeafc96d1ef2c8a74987b44ffe4416adcf95f5bec4 /intern/cycles/render/stats.cpp
parent709b36e43b94678b18fec20a92d7d34f9b5aa78b (diff)
Cycles: Initial implementation of detailed statistics
Gathers information about object geometry and textures. Very basic at this moment, but need to start somewhere. Things which needs to be included still: - "Runtime" information, like BVH. While it is not directly controllable by artists, it's still important to know. - Device array sizes. Again, not under artists control, but is added to the overall size. - Memory peak at different synchronization stages. At this point it simply prints info to the stdout after F12 is done, need better control over that too. Reviewers: brecht Differential Revision: https://developer.blender.org/D3566
Diffstat (limited to 'intern/cycles/render/stats.cpp')
-rw-r--r--intern/cycles/render/stats.cpp119
1 files changed, 119 insertions, 0 deletions
diff --git a/intern/cycles/render/stats.cpp b/intern/cycles/render/stats.cpp
new file mode 100644
index 00000000000..101d33fcf65
--- /dev/null
+++ b/intern/cycles/render/stats.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2011-2018 Blender Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "render/stats.h"
+#include "util/util_algorithm.h"
+#include "util/util_foreach.h"
+#include "util/util_string.h"
+
+CCL_NAMESPACE_BEGIN
+
+static int kIndentNumSpaces = 2;
+
+/* Named size entry. */
+
+namespace {
+
+bool namedSizeEntryComparator(const NamedSizeEntry& a, const NamedSizeEntry& b)
+{
+ /* We sort in descending order. */
+ return a.size > b.size;
+}
+
+} // namespace
+
+NamedSizeEntry::NamedSizeEntry()
+ : name(""),
+ size(0) {
+}
+
+NamedSizeEntry::NamedSizeEntry(const string& name, size_t size)
+ : name(name),
+ size(size) {
+}
+
+/* Named size statistics. */
+
+NamedSizeStats::NamedSizeStats()
+ : total_size(0) {
+}
+
+void NamedSizeStats::add_entry(const NamedSizeEntry& entry) {
+ total_size += entry.size;
+ entries.push_back(entry);
+}
+
+string NamedSizeStats::full_report(int indent_level)
+{
+ const string indent(indent_level * kIndentNumSpaces, ' ');
+ const string double_indent = indent + indent;
+ string result = "";
+ result += string_printf("%sTotal memory: %s (%s)\n",
+ indent.c_str(),
+ string_human_readable_size(total_size).c_str(),
+ string_human_readable_number(total_size).c_str());
+ sort(entries.begin(), entries.end(), namedSizeEntryComparator);
+ foreach(const NamedSizeEntry& entry, entries) {
+ result += string_printf(
+ "%s%-32s %s (%s)\n",
+ double_indent.c_str(),
+ entry.name.c_str(),
+ string_human_readable_size(entry.size).c_str(),
+ string_human_readable_number(entry.size).c_str());
+ }
+ return result;
+}
+
+/* Mesh statistics. */
+
+MeshStats::MeshStats() {
+}
+
+string MeshStats::full_report(int indent_level)
+{
+ const string indent(indent_level * kIndentNumSpaces, ' ');
+ string result = "";
+ result += indent + "Geometry:\n" + geometry.full_report(indent_level + 1);
+ return result;
+}
+
+/* Image statistics. */
+
+ImageStats::ImageStats() {
+}
+
+string ImageStats::full_report(int indent_level)
+{
+ const string indent(indent_level * kIndentNumSpaces, ' ');
+ string result = "";
+ result += indent + "Textures:\n" + textures.full_report(indent_level + 1);
+ return result;
+}
+
+/* Overall statistics. */
+
+RenderStats::RenderStats() {
+}
+
+string RenderStats::full_report()
+{
+ string result = "";
+ result += "Mesh statistics:\n" + mesh.full_report(1);
+ result += "Image statistics:\n" + image.full_report(1);
+ return result;
+}
+
+CCL_NAMESPACE_END