summaryrefslogtreecommitdiff
path: root/ztspeed.c
blob: 045d2b37350cc4747d2aa9b894e74e705da700c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2 as published by the
 * Free Software Foundation. See the LICENSE file included with
 * this program for more details.
 */

/*
 * 
 * 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++;
	}
}