[Libreoffice-commits] online.git: 2 commits - kit/Kit.cpp scripts/perftrace.pl

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Mar 29 09:50:55 UTC 2019


 kit/Kit.cpp          |   12 +++++++++
 scripts/perftrace.pl |   63 +++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 68 insertions(+), 7 deletions(-)

New commits:
commit 9b4afbb460c0aab0039b6106b54f19ec90ffa592
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Mar 23 12:20:20 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Mar 29 09:49:23 2019 +0000

    Disable potentially problematic module loads for online.
    
    Change-Id: Iaa30486977ad783e2af0f876d790f2a2b06904f9

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 7bdb2cd78..faf6ad4f8 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -2655,6 +2655,18 @@ bool globalPreinit(const std::string &loTemplate)
         LOG_FTL("No libreofficekit_hook_2 symbol in " << loadedLibrary << ": " << dlerror());
     }
 
+    // Disable problematic components that may be present from a
+    // desktop or developer's install if env. var not set.
+    ::setenv("UNODISABLELIBRARY",
+             "abp avmediagst avmediavlc cmdmail losessioninstall OGLTrans PresenterScreen "
+             "syssh ucpftp1 ucpgio1 ucphier1 ucpimage updatecheckui updatefeed updchk"
+             // Database
+             "dbaxml dbmm dbp dbu deployment firebird_sdbc fps_office mork "
+             "mysql mysqlc odbc postgresql-sdbc postgresql-sdbc-impl sdbc2 sdbt"
+             // Java
+             "javaloader javavm jdbc rpt rptui rptxml ",
+             0 /* no overwrite */);
+
     LOG_TRC("Invoking lok_preinit(" << loTemplate << "/program\", \"file:///user\")");
     const auto start = std::chrono::steady_clock::now();
     if (preInit((loTemplate + "/program").c_str(), "file:///user") != 0)
commit cadcc6e166d4b69b03e4baa40f6184f9b27ffaf2
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Mar 29 09:36:46 2019 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Mar 29 09:37:28 2019 +0000

    perftrace: start to annotate common spans.
    
    Change-Id: I90e9939ddc7dedfb24fd608f13ea31a2863ebe3e

diff --git a/scripts/perftrace.pl b/scripts/perftrace.pl
index 90fe06105..d050d9fe3 100755
--- a/scripts/perftrace.pl
+++ b/scripts/perftrace.pl
@@ -18,29 +18,78 @@ my @events;
 sub escape($)
 {
     my $str = shift;
+    $str =~ s/\\/\\\\/g;
     $str =~ s/\$/\\\$/g;
     $str =~ s/\'/\\'/g;
     $str =~ s/\"/\\"/g;
+    $str =~ s/\&/&/g;
+    $str =~ s/\#/#/g;
+    $str =~ s/\>/>/g;
+    $str =~ s/\</</g;
+    $str =~ s/[\r\n]+/\\n/g;
     return $str;
 }
 
+# Delimit spans of time:
+my @pairs = (
+    { type => 'INF',
+      emitter => 'loolwsd',
+      start => 'Initializing wsd.\.*',
+      end => 'Listening to prisoner connections.*' },
+    { type => 'INF',
+      emitter => 'forkit',
+      start => 'Initializing frk.\.*',
+      end => 'ForKit process is ready.*'
+    }
+);
+my %pair_starts;
+
 sub consume($$$$$)
 {
     my ($time, $emitter, $type, $message, $line) = @_;
 
+    # print STDERR "$emitter, $type, $time, $message, $line\n";
+
+    # accumulate all threads / processes
     if (!defined $emitters{$emitter}) {
 	$emitters{$emitter} = (scalar keys %emitters) + 1;
     }
 
-    return if ($type eq 'TRC' || $type eq 'DBG' || $type eq 'ERR');
+    my $handled = 0;
+    foreach my $match (@pairs) {
+	next if ($type ne $match->{type});
+	next if (!($emitter =~ m/$match->{emitter}/));
+
+	my $start = $match->{start};
+	my $end = $match->{end};
+	my $key = $type.$emitter.$start;
+	if ($message =~ m/$start/) {
+	    defined $pair_starts{$key} && die "event $start ($end) starts and fails to finish";
+	    $pair_starts{$key} = $time;
+	    last;
+	} elsif ($message =~ m/$end/) {
+	    defined $pair_starts{$key} || die "event $start ($end) ends but failed to start";
+
+	    my $id = (scalar @events) + 1;
+
+	    my $content_e = escape($start);
+	    my $title_e = escape($line);
+	    my $start_time = $pair_starts{$key};
+	    my $end_time = $time;
+	    push @events, "{id: $id, group: $emitters{$emitter}, ".
+		"start: new Date('$log_date $start_time'), ".
+		"end: new Date('$log_date $end_time'), ".
+		"content: '$content_e', title: '$title_e'}";
+	    last;
+	}
+    }
 
+    my $content_e = escape($message. " " . $line);
     my $id = (scalar @events) + 1;
-    # omitted 'end' - should really synthesize more cleverly here. title: '$message_e'
-    my $message_e = escape($message);
-    my $line_e = escape($line);
-    push @events, "{id: $id, group: $emitters{$emitter}, start: new Date('$log_date $time'), content: '$line_e'}";
-
-#    print STDERR "$emitter, $type, $time, $message, $line\n";
+    push @events, "{id: $id, group: $emitters{$emitter}, ".
+	"start: new Date('$log_date $time'), ".
+	"end: new Date('$log_date $time)') + new Date(1), ".
+	"content: '$content_e', title: ''}";
 }
 
 sub emit()


More information about the Libreoffice-commits mailing list