<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://bugs.maemo.com/skins/common/feed.css?207"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Documentation/devtools/maemo5/sp-startup-time - Revision history</title>
		<link>http://bugs.maemo.com/index.php?title=Documentation/devtools/maemo5/sp-startup-time&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.5-7</generator>
		<lastBuildDate>Tue, 07 Apr 2026 08:27:05 GMT</lastBuildDate>
		<item>
			<title>amigadave:&amp;#32;devtools template</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/devtools/maemo5/sp-startup-time&amp;diff=30998&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/devtools/maemo5/sp-startup-time&amp;diff=30998&amp;oldid=prev</guid>
			<description>&lt;p&gt;devtools template&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 15:21, 11 March 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;{{Devtools}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Description ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Description ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 296:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 299:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Documentation/devtools/maemo5/syslog|syslog]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Documentation/devtools/maemo5/syslog|syslog]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Devtools]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Fremantle]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Fremantle]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-07 08:27:05 --&gt;
&lt;/table&gt;</description>
			<pubDate>Thu, 11 Mar 2010 15:21:27 GMT</pubDate>			<dc:creator>amigadave</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/devtools/maemo5/sp-startup-time</comments>		</item>
		<item>
			<title>amigadave:&amp;#32;Category:Devtools and Category:Fremantle</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/devtools/maemo5/sp-startup-time&amp;diff=29282&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/devtools/maemo5/sp-startup-time&amp;diff=29282&amp;oldid=prev</guid>
			<description>&lt;p&gt;&lt;a href=&quot;/Category:Devtools&quot; title=&quot;Category:Devtools&quot;&gt;Category:Devtools&lt;/a&gt; and &lt;a href=&quot;/Category:Fremantle&quot; title=&quot;Category:Fremantle&quot;&gt;Category:Fremantle&lt;/a&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:40, 12 February 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 295:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 295:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Documentation/devtools/maemo5/syslog|syslog]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Documentation/devtools/maemo5/syslog|syslog]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Devtools]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Fremantle]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-07 08:27:05 --&gt;
&lt;/table&gt;</description>
			<pubDate>Fri, 12 Feb 2010 11:40:09 GMT</pubDate>			<dc:creator>amigadave</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/devtools/maemo5/sp-startup-time</comments>		</item>
		<item>
			<title>kaltsi:&amp;#32;New page: == Description ==  ''sp-startup-time'' provides a library that can be preloaded with &lt;code&gt;LD_PRELOAD&lt;/code&gt; to measure the startup time of Gtk applications.  You can use it to identify bo...</title>
			<link>http://bugs.maemo.com/index.php?title=Documentation/devtools/maemo5/sp-startup-time&amp;diff=19368&amp;oldid=prev</link>
			<guid>http://bugs.maemo.com/index.php?title=Documentation/devtools/maemo5/sp-startup-time&amp;diff=19368&amp;oldid=prev</guid>
			<description>&lt;p&gt;New page: == Description ==  &amp;#39;&amp;#39;sp-startup-time&amp;#39;&amp;#39; provides a library that can be preloaded with &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to measure the startup time of Gtk applications.  You can use it to identify bo...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Description ==&lt;br /&gt;
&lt;br /&gt;
''sp-startup-time'' provides a library that can be preloaded with &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to measure the startup time of Gtk applications.&lt;br /&gt;
&lt;br /&gt;
You can use it to identify bottlenecks in your application's startup and possibly to improve the user experience by providing you information to optimize the startup time.&lt;br /&gt;
&lt;br /&gt;
== Packages ==&lt;br /&gt;
&lt;br /&gt;
'''source''': sp-startup-time&lt;br /&gt;
&lt;br /&gt;
'''binary''': sp-startup-time, sp-startup-time-dbg, sp-startup-time-dev&lt;br /&gt;
&lt;br /&gt;
== Usage Examples ==&lt;br /&gt;
&lt;br /&gt;
=== How it works ===&lt;br /&gt;
&lt;br /&gt;
There are a few functions that are typically called during a Gtk application's startup and ''libstartup'' intercepts these function calls and collects the time each of them was called. The startup is considered finished once the installed Gtk idle callback is called.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; has some shortcomings:&lt;br /&gt;
&lt;br /&gt;
* It can be used only if the applications can be run directly,  i.e. it does not work with maemo-launched Gtk applications.&lt;br /&gt;
&lt;br /&gt;
* Prelink information cannot be used with &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt;. This means that prelinked applications spend time in resolving library symbols when this is used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note!&lt;br /&gt;
In scratchbox &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; does not work directly because scratchbox uses that by itself, use the ''run-with-startup-time'' script instead.&lt;br /&gt;
&lt;br /&gt;
If instructed, '''libstartup''' will also write a full log of the intercepted calls. This is done at the time the application is unloaded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Preloading ===&lt;br /&gt;
&lt;br /&gt;
You can use two methods for preloading the '''libstartup''' binary during application execution; environment or global &amp;lt;code&amp;gt;ld.so&amp;lt;/code&amp;gt; configuration.&lt;br /&gt;
&lt;br /&gt;
Setting the &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; environment variable like below is preferred as that way it doesn't affect any other programs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# LD_PRELOAD=/usr/lib/sp-startup-time/libstartup.so app-to-run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However if the &amp;quot;app-to-run&amp;quot; happens to be a launcher script, not a real binary you might need to edit the script itself to contain the preload setting like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
export LD_PRELOAD=/usr/lib/sp-startup-time/libstartup.so&lt;br /&gt;
app-to-run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apart from the environment you can use the global &amp;lt;code&amp;gt;ld.so&amp;lt;/code&amp;gt; configuration to force preloading libstartup for all applications by editing the &amp;lt;code&amp;gt;/etc/ld.so.preload&amp;lt;/code&amp;gt; file. This is not however encouraged as any mistake might make the system unbootable.&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
Normally ''libstartup'' writes the time application used to reach Gtk idle into syslog, but you can get more detailed information and direct it also to elsewhere with something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export STARTUP_IDLE_QUIT=yes&lt;br /&gt;
export STARTUP_WRITE_LOG=yes&lt;br /&gt;
export STARTUP_LOG_FILE=/home/user/startup-log.csv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also &amp;quot;How to interpret the results&amp;quot; below.&lt;br /&gt;
&lt;br /&gt;
The environment variables and how they control the runtime behavior of libstartup are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
STARTUP_LOG_DIR&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explicitly set the directory where ''libstartup'' will write the logs.&lt;br /&gt;
	&lt;br /&gt;
If not set the logs will be written to the current working directory of the process at the time when libstartup init is called - that is just before the main function is entered.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
STARTUP_LOG_FILE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explicitly set path used for writing logs.&lt;br /&gt;
	&lt;br /&gt;
If not set&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;amp;lt;$STARTUP_LOG_DIR&amp;amp;gt;/&amp;amp;lt;appname&amp;amp;gt;--&amp;amp;lt;pid&amp;amp;gt;.startup&amp;lt;/code&amp;gt;&lt;br /&gt;
will be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
STARTUP_WRITE_LOG&lt;br /&gt;
&amp;lt;/code&amp;gt;	&lt;br /&gt;
&lt;br /&gt;
If set to '&amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt;', and the process reaches Gtk idle state, the full startup log will be written.&lt;br /&gt;
	&lt;br /&gt;
If set to '&amp;lt;code&amp;gt;force&amp;lt;/code&amp;gt;' the startup log will be written always, not just for Gtk apps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
STARTUP_IDLE_QUIT&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If set (to anything) &amp;lt;code&amp;gt;gtk_main_quit()&amp;lt;/code&amp;gt; will be called when idle state is reached. This is useful for batch testing several runs/applications.&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
The values can also be set by writing them to &amp;lt;code&amp;gt;/tmp/startup.env&amp;lt;/code&amp;gt;. This allows changing configuration for applications for which the environment values would be hard to modify. You could for example use &amp;lt;code&amp;gt;/etc/ld.so.preload&amp;lt;/code&amp;gt; to globally enable libstartup use for all applications and then set the configuration options via &amp;lt;code&amp;gt;/tmp/startup.env&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Custom timestamps ===&lt;br /&gt;
&lt;br /&gt;
Sometimes you might want to add application specific measurement points to the libstartup log. This can be accomplished by inserting code similar to the example below to the application source file(s):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
+------- hello.c -------------------------------------------&lt;br /&gt;
#include &amp;amp;lt;stdio.h&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
void __cyg_profile_func_enter(const void *, const void *);&lt;br /&gt;
&lt;br /&gt;
#define libstartup_custom_timestamp(text) \&lt;br /&gt;
  __cyg_profile_func_enter((void *)(-1),text)&lt;br /&gt;
&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  sleep(1);&lt;br /&gt;
&lt;br /&gt;
  libstartup_custom_timestamp(&amp;quot;main1&amp;quot;);&lt;br /&gt;
  printf(&amp;quot;hello, &amp;quot;); fflush(stdout);&lt;br /&gt;
  sleep(1);&lt;br /&gt;
&lt;br /&gt;
  libstartup_custom_timestamp(&amp;quot;main2&amp;quot;);&lt;br /&gt;
  printf(&amp;quot;world\n&amp;quot;); fflush(stdout);&lt;br /&gt;
  sleep(1);&lt;br /&gt;
&lt;br /&gt;
  libstartup_custom_timestamp(&amp;quot;main3&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  sleep(1);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
+------- hello.c -------------------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It compiles as usual:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# gcc -o hello hello.c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
It executes as normal without ''libstartup'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ./hello &lt;br /&gt;
hello, world&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And you get the custom timestamps with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# on device:&lt;br /&gt;
$ STARTUP_WRITE_LOG=f LD_PRELOAD=/usr/lib/sp-startup-time/libstartup.so ./hello&lt;br /&gt;
&lt;br /&gt;
# in scratchbox:&lt;br /&gt;
$ STARTUP_WRITE_LOG=f run-with-startup ./hello&lt;br /&gt;
&lt;br /&gt;
hello, world&lt;br /&gt;
&lt;br /&gt;
# a file will be created:&lt;br /&gt;
+------- hello--5092.startup -------------------------------&lt;br /&gt;
generator=sp-startup-time 0.0.7&lt;br /&gt;
create_tod=1195657960.406658&lt;br /&gt;
&lt;br /&gt;
t_tod,t_real,t_user,t_sys,f_real,f_user,f_sys,name&lt;br /&gt;
1195657960.406658,0.000,0.000,0.000,0.000,0.000,0.000,create&lt;br /&gt;
1195657960.406660,0.000,0.000,0.000,0.000,0.000,0.000,lib_init&lt;br /&gt;
1195657961.412616,1.000,0.000,0.000,0.000,0.000,0.000,main1&lt;br /&gt;
1195657962.422009,2.010,0.000,0.000,0.000,0.000,0.000,main2&lt;br /&gt;
1195657963.427050,3.020,0.000,0.000,0.000,0.000,0.000,main3&lt;br /&gt;
1195657964.432335,4.020,0.000,0.000,0.000,0.000,0.000,lib_exit&lt;br /&gt;
1195657964.432337,4.020,0.000,0.000,0.000,0.000,0.000,lib_fini&lt;br /&gt;
+------- hello--5092.startup -------------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rationale behind hijacking &amp;lt;code&amp;gt;__cyg_profile_func_enter()&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* we can't override functions defined in the main application binary using &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; -&amp;gt; it must be in some library&lt;br /&gt;
  &lt;br /&gt;
* we could provide dummy library with some kind of hook, but that would require modifying the application linking, not just the source code&lt;br /&gt;
  &lt;br /&gt;
=&amp;gt; we use a dummy function provided by gnu libc&lt;br /&gt;
&lt;br /&gt;
Note: The amount of measurement points is currently limited to 32. For Gtk applications this should leave 20 or so custom entries.&lt;br /&gt;
&lt;br /&gt;
Note: If the same custom tag is used several times, only the last occurence is placed to the log file.&lt;br /&gt;
&lt;br /&gt;
=== How to interpret the results ===&lt;br /&gt;
&lt;br /&gt;
==== syslog ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Jan 27 14:33:51 localhost libstartup[12706]: firefox-bin=1.19 seconds&lt;br /&gt;
Jan 27 14:34:32 localhost libstartup[12727]: firefox-bin=1.13 seconds&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elapsed wall-clock time from process creation to Gtk idle time is written as seconds.&lt;br /&gt;
&lt;br /&gt;
==== startup log ====&lt;br /&gt;
&lt;br /&gt;
Entry time stamp:&lt;br /&gt;
&lt;br /&gt;
- &amp;lt;code&amp;gt;t_tod&amp;lt;/code&amp;gt; time since epoch.&lt;br /&gt;
- &amp;lt;code&amp;gt;t_real&amp;lt;/code&amp;gt; elapsed time since process create&lt;br /&gt;
- &amp;lt;code&amp;gt;t_user&amp;lt;/code&amp;gt; CPU time spent in user land before call&lt;br /&gt;
- &amp;lt;code&amp;gt;t_sys&amp;lt;/code&amp;gt;  CPU time spent in kernel space before call&lt;br /&gt;
 &lt;br /&gt;
Time within:&lt;br /&gt;
&lt;br /&gt;
- &amp;lt;code&amp;gt;f_real&amp;lt;/code&amp;gt; elapsed time within entry&lt;br /&gt;
- &amp;lt;code&amp;gt;t_user&amp;lt;/code&amp;gt; CPU time spent in user land during the call&lt;br /&gt;
- &amp;lt;code&amp;gt;t_sys&amp;lt;/code&amp;gt;  CPU time spent in kernel space during the call&lt;br /&gt;
  &lt;br /&gt;
Entry identification:&lt;br /&gt;
&lt;br /&gt;
- &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;   name of called function, or function1.leave-&amp;gt;function2.entry transition&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
+------- firefox-bin--12727.startup ------------------------&lt;br /&gt;
generator=sp-startup-time 0.0.7&lt;br /&gt;
create_tod=1195658611.448291&lt;br /&gt;
&lt;br /&gt;
t_tod,t_real,t_user,t_sys,f_real,f_user,f_sys,name&lt;br /&gt;
1195658611.448291,0.000,0.000,0.000,0.280,0.000,0.010,create&lt;br /&gt;
1195658611.728293,0.280,0.000,0.010,0.000,0.000,0.000,lib_init&lt;br /&gt;
1195658611.729729,0.280,0.000,0.010,0.000,0.000,0.000,gtk_init&lt;br /&gt;
1195658611.735175,0.280,0.000,0.010,3.010,0.110,0.040,gtk_init-&amp;gt;gtk_main&lt;br /&gt;
1195658614.744454,3.290,0.110,0.050,0.000,0.000,0.000,gtk_main&lt;br /&gt;
1195658614.744454,3.290,0.110,0.050,2.290,0.290,0.030,gtk_main-&amp;gt;gui_idle&lt;br /&gt;
1195658617.032341,5.580,0.400,0.080,0.000,0.000,0.000,gui_idle&lt;br /&gt;
1195658617.032341,5.580,0.400,0.080,18.740,0.120,0.020,gui_idle-&amp;gt;gtk_main_quit&lt;br /&gt;
1195658635.775691,24.320,0.520,0.100,0.010,0.000,0.000,gtk_main_quit&lt;br /&gt;
1195658635.775702,24.330,0.520,0.100,0.080,0.050,0.000,gtk_main_quit-&amp;gt;lib_exit&lt;br /&gt;
1195658635.855718,24.410,0.570,0.100,0.000,0.000,0.000,lib_exit&lt;br /&gt;
1195658635.855720,24.410,0.570,0.100,0.000,0.000,0.000,lib_fini&lt;br /&gt;
+------- firefox-bin--12727.startup ------------------------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following calls are intercepted and logged. The entries with preceding '+' will have time stamps for both entry to and leave from function. The ones marked with '-' will have only entry time stamps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
+ create	&lt;br /&gt;
+ lib_init	(installs lib_exit as atexit handler)	&lt;br /&gt;
+ gtk_init	(installs gui_idle as gtk idle handler)		&lt;br /&gt;
- gtk_main	&lt;br /&gt;
- gui_idle	&lt;br /&gt;
+ gtk_main_quit		&lt;br /&gt;
- lib_exit	&lt;br /&gt;
- lib_fini	&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The timestamps are obtained with &amp;lt;code&amp;gt;times()&amp;lt;/code&amp;gt; syscall which allows us to trace:&lt;br /&gt;
&lt;br /&gt;
- &amp;lt;code&amp;gt;real time&amp;lt;/code&amp;gt; (elapsed wall clock time)&lt;br /&gt;
- &amp;lt;code&amp;gt;user time&amp;lt;/code&amp;gt; (time spent executing code)&lt;br /&gt;
- &amp;lt;code&amp;gt;sys time&amp;lt;/code&amp;gt;  (time spent in kernel servicing the process)&lt;br /&gt;
&lt;br /&gt;
If there time difference between leaving the previous traced function and entering the next, a transition entry will be written. The interpretation of these transition entries depends on the situation, but generally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lib_init -&amp;gt; gtk_init&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usually libstartup initialization is executed just before control is yielded to &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt; entry of the application.  So this transition can be considered as &amp;quot;non-gui-init&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;gtk_init -&amp;gt; gtk_main&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Setting up application main GUI.&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;code&amp;gt;gtk_main -&amp;gt; gui_idle&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Realizing application main GUI.&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;code&amp;gt;gui_idle -&amp;gt; gtk_main_quit&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Normal application operation.&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;code&amp;gt;gtk_main_quit -&amp;gt; lib_exit&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Application shutdown&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;code&amp;gt;lib_exit -&amp;gt; lib_fini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the &amp;lt;code&amp;gt;lib_exit&amp;lt;/code&amp;gt; is most likely the last &amp;lt;code&amp;gt;atexit&amp;lt;/code&amp;gt; handler called and &amp;lt;code&amp;gt;lib_fini&amp;lt;/code&amp;gt; the first library unload code executed, this is very unlikely to have nonzero time.&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
The &amp;quot;create&amp;quot; entry needs a bit of explanation too. The idea is that this contains time taken by the dynamic linker to bind the various binaries to the process. As the init code from ''libstartup'' is if not the last at least one of the last things done before entering application &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt; function, we can guess that the CPU time spent before this is from the dynamic loader. Perhaps surprisingly determining the real time is quite difficult. The reason is that the syscalls that can be used to query time values return corrected real time and the process create time (as available via &amp;lt;code&amp;gt;/proc/pid/status&amp;lt;/code&amp;gt;) contains uncorrected jiffies value. To overcome this the ''libstartup'' forks a child process and uses the create time difference between parent and child as elapsed real time estimate. The child process is terminated right after the time difference evaluation.&lt;br /&gt;
&lt;br /&gt;
The idle detection is also not without problems. It is common that there is a brief idle period right after entering &amp;lt;code&amp;gt;gtk_main&amp;lt;/code&amp;gt;. For this reason the idle status is is noted only when the idle handler is called enough times without using CPU for other purposes (in the context of the application process).&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
[run-with-startup-time man page](/development/documentation/man_pages/run-with-startup-time.html)&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
[[Documentation/devtools/maemo5/syslog|syslog]]&lt;/div&gt;</description>
			<pubDate>Tue, 06 Oct 2009 08:50:21 GMT</pubDate>			<dc:creator>kaltsi</dc:creator>			<comments>http://bugs.maemo.com/Talk:Documentation/devtools/maemo5/sp-startup-time</comments>		</item>
	</channel>
</rss>