[Bf-blender-cvs] [6e3569d9f49] blender2.8: Depsgraph: Escape underscore in time stats chart

Sergey Sharybin noreply at git.blender.org
Fri Aug 24 10:59:58 CEST 2018


Commit: 6e3569d9f49c4724adfee45de08c0ec38e46425a
Author: Sergey Sharybin
Date:   Fri Aug 24 10:16:05 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB6e3569d9f49c4724adfee45de08c0ec38e46425a

Depsgraph: Escape underscore in time stats chart

===================================================================

M	source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
index 35888f8d5e3..bb79085ae51 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
@@ -87,6 +87,25 @@ bool stat_entry_comparator(const StatsEntry& a, const StatsEntry& b)
 	return a.time < b.time;
 }
 
+string gnuplotify_id_code(const string& name)
+{
+	return string("") + name[0] + name [1];
+}
+
+string gnuplotify_name(const string& name)
+{
+	string result = "";
+	const int length = name.length();
+	for (int i = 0; i < length; ++i) {
+		const char ch = name[i];
+		if (ch == '_') {
+			result += "\\\\\\";
+		}
+		result += ch;
+	}
+	return result;
+}
+
 void write_stats_data(const DebugContext& ctx)
 {
 	// Fill in array of all stats which are to be displayed.
@@ -109,9 +128,11 @@ void write_stats_data(const DebugContext& ctx)
 	// Print data to the file stream.
 	deg_debug_fprintf(ctx, "$data << EOD" NL);
 	foreach (const StatsEntry& entry, stats) {
-		deg_debug_fprintf(ctx, "\"%s\",%f" NL,
-		                  entry.id_node->id_orig->name + 2,
-		                  entry.time);
+		deg_debug_fprintf(
+		        ctx, "\"[%s] %s\",%f" NL,
+		        gnuplotify_id_code(entry.id_node->id_orig->name).c_str(),
+		        gnuplotify_name(entry.id_node->id_orig->name + 2).c_str(),
+		        entry.time);
 	}
 	deg_debug_fprintf(ctx, "EOD" NL);
 }



More information about the Bf-blender-cvs mailing list