kit/Kit.cpp | 2 ++ scripts/perftrace.pl | 40 +++++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 13 deletions(-)
New commits: commit ca619e6fd7add691b1e44c0b19a46b7cf9e0da8f Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Thu Apr 4 20:01:19 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Thu Apr 4 20:01:19 2019 +0100 perftrace: annotate start events as idle as well. Change-Id: Iaf603101426caca1f48ebe10918170287aee006d diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 42663d3ee..7555ae9eb 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1344,6 +1344,8 @@ public: } else tileQueue->put("callback " + std::to_string(descriptor->getViewId()) + ' ' + std::to_string(type) + ' ' + payload); + + LOG_TRC("Document::ViewCallback end."); } private: diff --git a/scripts/perftrace.pl b/scripts/perftrace.pl index a5b1a01d4..f639fb2f1 100755 --- a/scripts/perftrace.pl +++ b/scripts/perftrace.pl @@ -88,21 +88,33 @@ my @event_pairs = ( ); # Idle events -my @idle_types = ( +my @idleend_types = ( '^Poll completed' ); +my @idlestart_types = ( + '^Document::ViewCallback end\.' + ); + my %pair_starts; my %proc_names; -sub get_event_type($$$) +sub match_list($@) { - my ($type, $emitter, $message) = @_; - foreach my $match (@idle_types) { + my $message = shift; + while (my $match = shift) { if ($message =~ m/$match/) { - return 'idle'; + return 1; } } + return 0; +} + +sub get_event_type($$$) +{ + my ($type, $emitter, $message) = @_; + return 'idle_end' if (match_list($message, @idleend_types)); + return 'idle_start' if (match_list($message, @idlestart_types)); return ''; } @@ -110,6 +122,9 @@ sub consume($$$$$$$$) { my ($proc, $pid, $tid, $time, $emitter, $type, $message, $line) = @_; + $pid = int($pid); + $tid = int($tid); + # print STDERR "$emitter, $type, $time, $message, $line\n"; $time = offset_microsecs($time) if ($json); # microseconds from start @@ -118,13 +133,13 @@ sub consume($$$$$$$$) if (!defined $emitters{$emitter}) { $emitters{$emitter} = (scalar keys %emitters) + 1; if ($json) { - push @events, "{\"name\": \"thread_name\", \"ph\": \"M\", \"pid\": $pid, \"tid\": $tid, \"args\": { \"name\" : \"$emitter\" } }"; + push @events, "{\"name\": \"thread_name\", \"thread_sort_index\": -$tid, \"ph\": \"M\", \"pid\": $pid, \"tid\": $tid, \"args\": { \"name\" : \"$emitter\" } }"; } } if (!defined $proc_names{$pid}) { $proc_names{$pid} = 1; if ($json) { - push @events, "{\"name\": \"process_name\", \"ph\": \"M\", \"pid\": $pid, \"args\": { \"name\" : \"$proc\" } }"; + push @events, "{\"name\": \"process_name\", \"process_sort_index\": -$pid, \"ph\": \"M\", \"pid\": $pid, \"args\": { \"name\" : \"$proc\" } }"; } } @@ -178,17 +193,16 @@ sub consume($$$$$$$$) $dur = $time - $last_times{$key}; my $idx = $last_event_idx{$key}; - if ($event_type ne 'idle') { # onlt re-write if not idle - $events[$idx] =~ s/\"dur\":10/\"dur\":$dur/; - } else { - print STDERR "idle re-write to $dur\n"; - } + $dur = 1 if ($event_type eq 'idle_end' && $dur > 1); + $events[$idx] =~ s/\"dur\":10/\"dur\":$dur/; } $last_times{$key} = $time; $last_event_idx{$key} = scalar @events; my $json_type = "\"ph\":\"X\", \"s\":\"p\""; - push @events, "{\"pid\":$pid, \"tid\":$tid, \"ts\":$time, \"dur\":10, $json_type, \"name\":\"$content_e\" }"; + my $replace_dur = 10; + $replace_dur = 1 if ($event_type eq 'idle_start'); # miss the regexp + push @events, "{\"pid\":$pid, \"tid\":$tid, \"ts\":$time, \"dur\":$replace_dur, $json_type, \"name\":\"$content_e\" }"; } else { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits