Hi,
I'm thinking adding performance test suite to tracker code.
It will be under src/test-suites, by default, it will not be built and
installed otherwise user use option --enable-testsuites. The design
document (draft version) is attached along with the patch, please review
it. 

Thanks,
Halton.
Tracker performance test suite

Requirement Analysis
====================
    * Ability to clean up environment
    * Ability to change WatchDir by give parameter
    * Ability to dump interesting values start trackerd until it finish 
indexing, these values including:
        - StartTime : UTC Time when the tool is called.
        - EndTime   : UTC Time when the tool is finished.
        - InitTime  : trackerd init time, including setting up .db files, 
tracker.cfg.
        - IndexTime : Trackerd total indexing time for give WatchDir.
        - SourceDirSize: The whole size of WatchDirSize
        - Values for each file types: it is like an summary, it is valuable for 
storage sensitive system like Sunray     
             FileType: The file types among the WatchDir for give file types
             DocNum:   The documents number among the WatchDir for give file 
type
             TotalDocSize: The documents total size among the WatchDir for give 
file type
    * Ability to dump interesting values during trackerd is running
        - Time      : UTC Time when the tool is called.
        - CPU       : The percentage of recent CPU time by trackerd
        - Memory    : The memory size allocated to trackerd
    * Ability to dump testing results into a file (to let other tools analyse 
it)
                
Preliminary Design
====================
We have implement test suites including:
    * tracker-get-index-time : A tool can get D-Bus message called 
IndexFinished, get the index time out and print out, written by C.
    * tracker-cleanup  : A tool can cleanup tracker environment, like 
$HOME/.local/share/tracker, $HOME/.cache/tracker, 
$HOME/.config/tracker/tracker.cfg, written by shell or python.
    * tracker-test-init  : A tool can get values when start trackerd until it 
finish indexing, written by shell or python.
    * tracker-test-monitor  : A tool can monitor tracker during running time, 
record interesting values, written by shell or python.
                
Concept prototype
====================
    * tracker-get-index-time

    * tracker-cleanup
#!/bin/sh
pkill -9 tracker-applet
pkill -9 tracker-preferences
pkill trackerd
rm -rf $HOME/.local/share/tracker
rm -rf $HOME/.cache/tracker
rm -rf $HOME/.config/tracker/tracker.cfg

    * tracker-test-init
#!/bin/sh
/usr/bin/trackerd -R &
index_time=`./get-index-time`
echo $index_time >> index_time.log

    * tracker-test-monitor
Index: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	(revision 1087)
+++ trunk/src/Makefile.am	(working copy)
@@ -18,5 +18,9 @@
 trackerapplet_dir = tracker-applet
 endif
 
-SUBDIRS = libstemmer xdgmime $(qdbm_dir) text-filters trackerd libtracker tracker-extract tracker-thumbnailer $(libtrackergtk_dir) $(tracker_gui_dir) $(trackerapplet_dir) $(tracker_preferences_dir)
+if ENABLE_TESTSUITES
+test_suites_dir = test-suites
+endif
 
+SUBDIRS = libstemmer xdgmime $(qdbm_dir) text-filters trackerd libtracker tracker-extract tracker-thumbnailer $(libtrackergtk_dir) $(tracker_gui_dir) $(trackerapplet_dir) $(tracker_preferences_dir) $(test_suites_dir) 
+
Index: trunk/src/test-suites/tracker-cleanup
===================================================================
--- trunk/src/test-suites/tracker-cleanup	(revision 0)
+++ trunk/src/test-suites/tracker-cleanup	(revision 0)
@@ -0,0 +1,7 @@
+#!/bin/sh
+pkill trackerd
+pkill tracker-applet
+rm -rf $HOME/.local/share/tracker
+rm -rf $HOME/.cache/tracker
+rm -rf $HOME/.config/tracker/tracker.cfg
+

Property changes on: trunk/src/test-suites/tracker-cleanup
___________________________________________________________________
Name: svn:executable
   + *

Index: trunk/src/test-suites/Makefile.am
===================================================================
--- trunk/src/test-suites/Makefile.am	(revision 0)
+++ trunk/src/test-suites/Makefile.am	(revision 0)
@@ -0,0 +1,19 @@
+INCLUDES = \
+	-DTRACKER_DATADIR=\""$(datadir)/tracker"\" \
+	-DTRACKER_LOCALEDIR=\""$(localedir)"\" \
+	-DTRACKER_BINDIR=\""$(bindir)"\" \
+	$(TESTSUITES_CFLAGS) \
+	-I$(top_srcdir)/src/libtracker
+
+bin_PROGRAMS = tracker-get-index-time
+
+tracker_get_index_time_SOURCES = tracker-get-index-time.c 
+
+tracker_get_index_time_LDADD = \
+				$(TESTSUITES_CFLAGS) \
+				$(top_builddir)/src/libtracker/libtrackerclient.la
+
+bin_SCRIPTS = \
+	tracker-cleanup \
+	tracker-test-init \
+	tracker-test-monitor
Index: trunk/src/test-suites/tracker-test-init
===================================================================
--- trunk/src/test-suites/tracker-test-init	(revision 0)
+++ trunk/src/test-suites/tracker-test-init	(revision 0)
@@ -0,0 +1,4 @@
+#!/bin/sh
+/usr/bin/trackerd -R &
+index_time=`get-index-time`
+echo $index_time >> index_time.log

Property changes on: trunk/src/test-suites/tracker-test-init
___________________________________________________________________
Name: svn:executable
   + *

Index: trunk/src/test-suites/tracker-get-index-time.c
===================================================================
--- trunk/src/test-suites/tracker-get-index-time.c	(revision 0)
+++ trunk/src/test-suites/tracker-get-index-time.c	(revision 0)
@@ -0,0 +1,74 @@
+/* Tracker - indexer and metadata database engine
+ * Copyright (C) 2007, Mr Halton Huo ([EMAIL PROTECTED])
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include "../libtracker/tracker.h"
+
+static GMainLoop* loop;
+
+static void
+index_finished (DBusGProxy *proxy,  int time_taken, void *data)
+{
+	printf ("%d\n", time_taken);
+        g_main_loop_quit (loop);
+        exit (EXIT_SUCCESS);
+}
+
+
+static gboolean
+setup_dbus_connection ()
+{
+	TrackerClient *client;
+
+	client = tracker_connect (FALSE);
+
+	if (!client) {
+		g_print ("Could not initialise Tracker\n");
+		exit (1);
+	}
+
+
+	/* set signal handlers */
+	dbus_g_proxy_add_signal (client->proxy,
+                           "IndexFinished",
+                           G_TYPE_INT,
+                           G_TYPE_INVALID);
+
+   	dbus_g_proxy_connect_signal (client->proxy,
+				"IndexFinished",
+                               	G_CALLBACK (index_finished),
+                               	NULL,
+                               	NULL);
+
+	return FALSE;
+}
+
+int
+main (int argc, char *argv[])
+{
+	setup_dbus_connection ();
+        loop = g_main_loop_new (NULL, TRUE);
+        g_main_loop_run (loop);
+
+        return EXIT_SUCCESS;
+}
Index: trunk/src/test-suites/tracker-test-monitor
===================================================================
--- trunk/src/test-suites/tracker-test-monitor	(revision 0)
+++ trunk/src/test-suites/tracker-test-monitor	(revision 0)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+

Property changes on: trunk/src/test-suites/tracker-test-monitor
___________________________________________________________________
Name: svn:executable
   + *

Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac	(revision 1087)
+++ trunk/configure.ac	(working copy)
@@ -564,6 +564,30 @@
 
 
 ##################################################################
+# Enable building test?
+##################################################################
+
+AC_ARG_ENABLE([testsuites], AS_HELP_STRING([--disable-testsuites], [Disable test suites]),,[enable_testsuites=no])
+if test "x$enable_testsuites" != "xno" ; then
+
+   	testsuites_modules="\
+        	glib-2.0    >=  $GLIB_REQUIRED, \
+        	dbus-1      >=  $DBUS_REQUIRED, \
+        	dbus-glib-1 >=  $DBUS_REQUIRED"
+
+	PKG_CHECK_MODULES(TESTSUITES, [$testsuites_modules],[enable_testsuites=yes] , [enable_testsuites=no])
+
+    	AC_SUBST([TESTSUITES_CFLAGS])
+    	AC_SUBST([TESTSUITES_LIBS])
+
+	
+else
+	enable_testsuites="no (disabled)"
+fi
+
+AM_CONDITIONAL(ENABLE_TESTSUITES, test "$enable_testsuites" = "yes")
+
+##################################################################
 # Enable UNAC support?
 ##################################################################
 
@@ -818,6 +842,7 @@
 	src/tracker-preferences/Makefile
 	src/tracker-preferences/tracker-preferences.desktop.in	
 	src/xdgmime/Makefile
+	src/test-suites/Makefile
 	po/Makefile.in
 	python/Makefile
 	python/deskbar-handler/Makefile
@@ -846,6 +871,7 @@
 	build preferences ui:			$enable_preferences
 	build libtracker-gtk:			$enable_libtrackergtk
 	tracker applet notification icon:	$enable_trackerapplet
+	build test suites:			$enable_testsuites
 
 Metadata extractors:
 
_______________________________________________
tracker-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/tracker-list

Reply via email to