[maemo-commits] [maemo-commits] r15419 - in projects/haf/trunk/maemo-launcher: . launcher

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Apr 16 01:35:42 EEST 2008
Author: guillem
Date: 2008-04-16 01:35:42 +0300 (Wed, 16 Apr 2008)
New Revision: 15419

Added:
   projects/haf/trunk/maemo-launcher/launcher/test_msg_perf.c
Modified:
   projects/haf/trunk/maemo-launcher/ChangeLog
   projects/haf/trunk/maemo-launcher/launcher/Makefile.am
Log:
Add new test_msg_perf to check the comm_msg performance


Modified: projects/haf/trunk/maemo-launcher/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-launcher/ChangeLog	2008-04-15 22:35:40 UTC (rev 15418)
+++ projects/haf/trunk/maemo-launcher/ChangeLog	2008-04-15 22:35:42 UTC (rev 15419)
@@ -1,5 +1,12 @@
 2008-02-22  Guillem Jover  <guillem.jover at nokia.com>
 
+	* launcher/Makefile.am (check_PROGRAMS): Add 'test-msg-perf'.
+	(test_msg_perf_SOURCES): New variable.
+	(test_msg_perf_CPPFLAGS): Likewise.
+	* launcher/test_msg_perf.c: New file.
+
+2008-02-22  Guillem Jover  <guillem.jover at nokia.com>
+
 	* launcher/invoker.c (invoker_init): Do not take a delay argument.
 	Fix all callers. Move magic sending logic to ...
 	(invoker_send_magic): ... here. New function.

Modified: projects/haf/trunk/maemo-launcher/launcher/Makefile.am
===================================================================
--- projects/haf/trunk/maemo-launcher/launcher/Makefile.am	2008-04-15 22:35:40 UTC (rev 15418)
+++ projects/haf/trunk/maemo-launcher/launcher/Makefile.am	2008-04-15 22:35:42 UTC (rev 15419)
@@ -66,11 +66,14 @@
 maemo_summoner_CPPFLAGS = -DPROG_NAME="\"maemo-summoner\""
 maemo_summoner_LDADD = -ldl
 
-check_PROGRAMS = test-msg
+check_PROGRAMS = test-msg test-msg-perf
 
 test_msg_SOURCES = test_lib.h test_lib.c test_msg.c comm_msg.c report.c
 test_msg_CPPFLAGS = -DPROG_NAME="\"test-msg\""
 
+test_msg_perf_SOURCES = test_msg_perf.c comm_msg.c report.c
+test_msg_perf_CPPFLAGS = -DPROG_NAME="\"test-msg-perf\""
+
 TESTS = $(check_PROGRAMS)
 
 man_MANS = \

Added: projects/haf/trunk/maemo-launcher/launcher/test_msg_perf.c
===================================================================
--- projects/haf/trunk/maemo-launcher/launcher/test_msg_perf.c	2008-04-15 22:35:40 UTC (rev 15418)
+++ projects/haf/trunk/maemo-launcher/launcher/test_msg_perf.c	2008-04-15 22:35:42 UTC (rev 15419)
@@ -0,0 +1,64 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * Author: Guillem Jover <guillem.jover 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ */
+
+#include <unistd.h>
+#include <time.h>
+
+#include "comm_msg.h"
+#include "report.h"
+
+int
+main()
+{
+	comm_msg_t *msg;
+	uint32_t w = 0x87654321;
+	const int i_max = 100000, j_max = 100;
+	int i, j;
+	clock_t t_ini, t_end;
+	float secs;
+
+	/* Serializing. */
+
+	msg = comm_msg_new(j_max * 2 * sizeof(uint32_t), 0);
+
+	t_ini = clock();
+
+	for (i = 0; i < i_max; i++)
+	{
+		for (j = 0; j < j_max; j++)
+			comm_msg_pack_int(msg, w);
+
+		comm_msg_reset(msg);
+	}
+
+	t_end = clock();
+
+	comm_msg_destroy(msg);
+
+	secs = (float)(t_end - t_ini) / (float)CLOCKS_PER_SEC;
+
+	info("time needed to pack %d words: %f\n", i_max * j_max, secs);
+
+	return 0;
+}
+


More information about the maemo-commits mailing list