diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-08-24 11:16:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-08-24 11:59:54 +0300 |
commit | 6e3569d9f49c4724adfee45de08c0ec38e46425a (patch) | |
tree | 406cb677db6a253d5100b2118f7ad6be0b3303fc /source/blender/depsgraph/intern/debug | |
parent | b8c9df6f21587014cb6f11aa5bed6f9c1044e6ee (diff) |
Depsgraph: Escape underscore in time stats chart
Diffstat (limited to 'source/blender/depsgraph/intern/debug')
-rw-r--r-- | source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc | 27 |
1 files changed, 24 insertions, 3 deletions
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); } |