summaryrefslogtreecommitdiff
path: root/ztspeed.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-04-12 16:39:12 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-04-12 16:39:12 +0000
commitdbd7e753a1f32232bfc299bf141748a54f4eee8c (patch)
treea995b9e6c0fa65e55cc57cd1a7de2f8b9a22298f /ztspeed.c
parent43fcb5c12279af2204f4de08d1ea6fb693ccce15 (diff)
Version 0.2.0 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@76 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'ztspeed.c')
-rwxr-xr-xztspeed.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/ztspeed.c b/ztspeed.c
new file mode 100755
index 0000000..7b41d78
--- /dev/null
+++ b/ztspeed.c
@@ -0,0 +1,36 @@
+/*
+ *
+ * Generic speed test -- Run an infinite loop and
+ * see how high we can count (in 5 seconds). You
+ * can use this to measure how much CPU zaptel REALLY
+ * is taking.
+ *
+ * MUST BE COMPILED WITHOUT OPTIMIZATION
+ *
+ */
+
+#include <stdio.h>
+#include <sys/signal.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+static long count=0;
+
+static void alm(int sig)
+{
+ printf("Count: %ld\n", count);
+ exit(0);
+}
+
+
+int main(int argc, char *argv[])
+{
+ int a=0,b=0,c;
+ signal(SIGALRM, alm);
+ alarm(5);
+ for (;;) {
+ for (c=0;c<1000;c++)
+ a = a * b;
+ count++;
+ }
+}