ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/liblzf/bench.c
(Generate patch)

Comparing liblzf/bench.c (file contents):
Revision 1.8 by root, Tue May 6 22:49:18 2008 UTC vs.
Revision 1.11 by root, Sat Jul 18 05:59:21 2009 UTC

1#include <stdio.h> 1#include <stdio.h>
2#include <assert.h> 2#include <assert.h>
3#include <string.h> 3#include <string.h>
4#include <time.h> 4#include <time.h>
5#include <sys/time.h> 5#include <sys/time.h>
6#include <sys/times.h>
6#include <sys/types.h> 7#include <sys/types.h>
7#include <sys/socket.h> 8#include <sys/socket.h>
8#include <sys/ioctl.h> 9#include <sys/ioctl.h>
10#include <sys/stat.h>
11#include <sys/resource.h>
9#include <math.h> 12#include <math.h>
10#include <signal.h> 13#include <signal.h>
11#include <X11/Xlib.h> 14#include <X11/Xlib.h>
12 15
13#include "lzf.h" 16#include "lzf.h"
52 int lp; 55 int lp;
53 char buf[8192]; 56 char buf[8192];
54 int p[2]; 57 int p[2];
55 int evfd = eventfd (0, 0); 58 int evfd = eventfd (0, 0);
56 long ctr = 1; 59 long ctr = 1;
60 struct stat sbuf;
57 61
58 pipe (p); 62 pipe (p);
59 63
60 FILE *f = fopen ("data", "r"); 64 FILE *f = fopen ("data", "r");
61 fread (data, DSIZE, 1, f); 65 fread (data, DSIZE, 1, f);
62 fclose (f); 66 fclose (f);
63 67
64 signal (SIGURG, sigu); 68 signal (SIGURG, sigu);
65 69
66 for (lp = 0; lp < 100000; lp++) { 70 for (lp = 0; lp < 1000000; lp++) {
67 s=stamp(); 71 s=stamp();
68 72
69 snprintf (buf, 64, "<1.%llx>", (unsigned long long)0xa234567812ULL); 73 struct timespec ts; clock_gettime (CLOCK_THREAD_CPUTIME_ID, &ts);
74 //printf ("%9ld\n", ts.tv_nsec);//D
75 //struct rusage usage; getrusage (RUSAGE_SELF, &usage);
76 //struct tms tms; times (&tms);
77
70 //kill (0, SIGURG); 78 //kill (0, SIGURG);
71 //write (evfd, &ctr, 8); 79 //write (evfd, &ctr, 8);
72 //read (evfd, &ctr, 8); 80 //read (evfd, &ctr, 8);
73// write (p[1], &buf, 1); 81 //write (p[1], &buf, 1);
74// read (p[0], &buf, 4); 82 //read (p[0], &buf, 4);
83 //stat ("/etc/passwd", &sbuf);
84 //struct timeval tv; gettimeofday (&tv, 0);
85
86 //l = lzf_compress (data, DSIZE, data2, DSIZE*2);
87 //assert(l);
75 88
76 si[0]=measure(s); 89 si[0]=measure(s);
77 90
78 //j = lzf_decompress (data2, l, data3, DSIZE*2); 91 //j = lzf_decompress (data2, l, data3, DSIZE*2);
92 //assert (j == DSIZE);
79 93
80 printf ("\r%10d (%d) ", si[0], l); 94 printf ("\r%10d (%d) ", si[0], l);
81 if (si[0] < min && si[0] > 0) 95 if (si[0] < min && si[0] > 0)
82 { 96 {
83 printf ("\n"); 97 printf ("\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines