[maemo-commits] [maemo-commits] r18686 - in projects/haf/trunk/maemo-launcher: debian launcher

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jun 10 09:32:44 EEST 2009
Author: makarhun
Date: 2009-06-10 09:32:36 +0300 (Wed, 10 Jun 2009)
New Revision: 18686

Modified:
   projects/haf/trunk/maemo-launcher/debian/changelog
   projects/haf/trunk/maemo-launcher/launcher/prog.c
Log:
readying 0.35-5

Modified: projects/haf/trunk/maemo-launcher/debian/changelog
===================================================================
--- projects/haf/trunk/maemo-launcher/debian/changelog	2009-06-10 00:52:12 UTC (rev 18685)
+++ projects/haf/trunk/maemo-launcher/debian/changelog	2009-06-10 06:32:36 UTC (rev 18686)
@@ -1,3 +1,10 @@
+maemo-launcher (0.35-5) unstable; urgency=low
+
+  * Add timestamping to dlopen calls
+  * Use local instead of global lookup scope  
+
+ -- Janne Karhunen <Janne.Karhunen at nokia.com>  Mon, 27 May 2009 09:43:55 +0300
+
 maemo-launcher (0.35-4) unstable; urgency=low
 
   * Remove obsolete fork from 'appdied'

Modified: projects/haf/trunk/maemo-launcher/launcher/prog.c
===================================================================
--- projects/haf/trunk/maemo-launcher/launcher/prog.c	2009-06-10 00:52:12 UTC (rev 18685)
+++ projects/haf/trunk/maemo-launcher/launcher/prog.c	2009-06-10 06:32:36 UTC (rev 18686)
@@ -1,7 +1,8 @@
 /*
  * Copyright © 2005, 2006, 2007, 2008 Nokia Corporation
  *
- * Authors: Guillem Jover <guillem.jover at nokia.com>
+ * Authors: Guillem Jover <guillem.jover at nokia.com>,
+ *          Janne Karhunen <janne.karhunen at nokia.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,6 +23,9 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
 #ifdef HAVE_PRCTL_SET_NAME
 #include <sys/prctl.h>
 #endif
@@ -30,6 +34,8 @@
 #include "report.h"
 #include "prog.h"
 
+typedef unsigned long long ulong64;
+
 #ifdef DEBUG
 extern char **environ;
 
@@ -51,20 +57,44 @@
 }
 #endif
 
+ulong64  __attribute__ ((visibility ("hidden")))
+gettime_us (void)
+{
+  struct timeval tv;
+  ulong64 rc;
+  int r;
+
+  r = gettimeofday(&tv,0);
+  if ( r<0 )
+    return 0;
+
+  rc  = tv.tv_sec;
+  rc *= 1000000;
+  rc += tv.tv_usec;
+
+  return rc;
+}
+
 void
 load_main(prog_t *prog)
 {
   void *module;
   char *error_s;
+  ulong64 tv2,tv1;
 
-  /* Load the launched application. */
-  module = dlopen(prog->filename, RTLD_LAZY | RTLD_GLOBAL);
+  tv1 = gettime_us();
+  module = dlopen (prog->filename, RTLD_LAZY|RTLD_LOCAL|RTLD_DEEPBIND);
+
   if (!module)
     die(1, "loading invoked application: '%s'\n", dlerror());
 
   dlerror();
   prog->entry = (entry_t)dlsym(module, "main");
   error_s = dlerror();
+
+  tv2 = gettime_us();
+  info("opening of %s took %llu microseconds\n", prog->filename, tv2-tv1);
+
   if (error_s != NULL)
     die(1, "loading symbol 'main': '%s'\n", error_s);
 }

More information about the maemo-commits mailing list