summaryrefslogtreecommitdiff
path: root/dahdi_speed.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2008-05-23 14:21:58 +0000
committerKevin P. Fleming <kpfleming@digium.com>2008-05-23 14:21:58 +0000
commit3403af6f5eba79740c98abb2678f9a66ef5a8190 (patch)
tree93415a9598e5363284832757de0596988a421aa6 /dahdi_speed.c
parentdb9cffbffeedcde4ee52027160b96a2548262c5d (diff)
initial copy
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@4335 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'dahdi_speed.c')
-rw-r--r--dahdi_speed.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/dahdi_speed.c b/dahdi_speed.c
new file mode 100644
index 0000000..7b41d78
--- /dev/null
+++ b/dahdi_speed.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++;
+ }
+}