WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add check for speed (takes 33 minutes on my laptop, OUCH

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add check for speed (takes 33 minutes on my laptop, OUCH!)
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Sep 2005 13:32:11 +0000
Delivery-date: Fri, 23 Sep 2005 13:29:38 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Rusty Russell <rusty@xxxxxxxxxxxxxxx>
# Node ID 6aef7d1062bb6035a2a84603d9f054b24e14c9b2
# Parent  8a757f283fb8013e220bd89848d78fdbd2362195
Add check for speed (takes 33 minutes on my laptop, OUCH!)

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

diff -r 8a757f283fb8 -r 6aef7d1062bb tools/xenstore/Makefile
--- a/tools/xenstore/Makefile   Fri Sep 23 12:30:54 2005
+++ b/tools/xenstore/Makefile   Fri Sep 23 13:24:58 2005
@@ -49,6 +49,11 @@
 xs_random: xs_random.o xs_test_lib.o xs_lib.o talloc.o utils.o
 xs_stress: xs_stress.o xs_test_lib.o xs_lib.o talloc.o utils.o
 xs_crashme: xs_crashme.o xs_lib.o talloc.o utils.o
+
+speedtest: speedtest.o xs.o xs_lib.o utils.o talloc.o
+
+check-speed: speedtest xenstored_test $(TESTDIR)
+       $(TESTENV) time ./speedtest 100
 
 xs_test.o xs_stress.o xenstored_core_test.o xenstored_watch_test.o 
xenstored_transaction_test.o xenstored_domain_test.o xs_random.o xs_test_lib.o 
talloc_test.o fake_libxc.o xs_crashme.o: CFLAGS=$(BASECFLAGS) $(TESTFLAGS)
 
diff -r 8a757f283fb8 -r 6aef7d1062bb tools/xenstore/speedtest.c
--- /dev/null   Fri Sep 23 12:30:54 2005
+++ b/tools/xenstore/speedtest.c        Fri Sep 23 13:24:58 2005
@@ -0,0 +1,130 @@
+/* 
+    Xen Store Daemon Speed test
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "utils.h"
+#include "xs.h"
+#include "list.h"
+#include "talloc.h"
+
+static void do_command(const char *cmd)
+{
+       int ret;
+
+       ret = system(cmd);
+       if (ret == -1 || !WIFEXITED(ret) || WEXITSTATUS(ret) != 0)
+               barf_perror("Failed '%s': %i", cmd, ret);
+}
+
+static int start_daemon(void)
+{
+       int fds[2], pid;
+
+       do_command(talloc_asprintf(NULL, "rm -rf testsuite/tmp/*"));
+
+       /* Start daemon. */
+       pipe(fds);
+       if ((pid = fork())) {
+               /* Child writes PID when its ready: we wait for that. */
+               char buffer[20];
+               close(fds[1]);
+               if (read(fds[0], buffer, sizeof(buffer)) < 0)
+                       barf("Failed to summon daemon");
+               close(fds[0]);
+       } else {
+               dup2(fds[1], STDOUT_FILENO);
+               close(fds[0]);
+#if 0
+               execlp("valgrind", "valgrind", "-q", 
"--suppressions=testsuite/vg-suppressions", "xenstored_test", "--output-pid",
+                      "--no-fork", "--trace-file=/tmp/trace", NULL);
+#else
+               execlp("./xenstored_test", "xenstored_test", "--output-pid", 
"--no-fork", NULL);
+//             execlp("strace", "strace", "-o", "/tmp/out", 
"./xenstored_test", "--output-pid", "--no-fork", NULL);
+#endif
+               exit(1);
+       }
+       return pid;
+}
+
+static void kill_daemon(int pid)
+{
+       int saved_errno = errno;
+       kill(pid, SIGTERM);
+       errno = saved_errno;
+}
+
+#define NUM_ENTRIES 50
+
+/* We create the given number of trees, each with NUM_ENTRIES, using
+ * transactions. */
+int main(int argc, char *argv[])
+{
+       int i, j, pid, print;
+       struct xs_handle *h;
+
+       if (argc != 2)
+               barf("Usage: speedtest <numdomains>");
+
+       pid = start_daemon();
+       h = xs_daemon_open();
+       print = atoi(argv[1]) / 76;
+       if (!print)
+               print = 1;
+       for (i = 0; i < atoi(argv[1]); i ++) {
+               char name[64];
+
+               if (i % print == 0)
+                       write(1, ".", 1);
+               if (!xs_transaction_start(h, "/")) {
+                       kill_daemon(pid);
+                       barf_perror("Starting transaction");
+               }
+               sprintf(name, "/%i", i);
+               if (!xs_mkdir(h, name)) {
+                       kill_daemon(pid);
+                       barf_perror("Making directory %s", name);
+               }
+
+               for (j = 0; j < NUM_ENTRIES; j++) {
+                       sprintf(name, "/%i/%i", i, j);
+                       if (!xs_write(h, name, name, strlen(name))) {
+                               kill_daemon(pid);
+                               barf_perror("Making directory %s", name);
+                       }
+               }
+               if (!xs_transaction_end(h, false)) {
+                       kill_daemon(pid);
+                       barf_perror("Ending transaction");
+               }
+       }
+       write(1, "\n", 1);
+
+       kill_daemon(pid);
+       wait(NULL);
+       return 0;
+}
+       
+       

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>