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

Comparing liblzf/bench.c (file contents):
Revision 1.11 by root, Sat Jul 18 05:59:21 2009 UTC vs.
Revision 1.12 by root, Sun May 30 05:46:56 2010 UTC

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/times.h>
7#include <sys/types.h> 7#include <sys/types.h>
8#include <sys/socket.h> 8#include <sys/socket.h>
9#include <sys/mman.h>
9#include <sys/ioctl.h> 10#include <sys/ioctl.h>
10#include <sys/stat.h> 11#include <sys/stat.h>
11#include <sys/resource.h> 12#include <sys/resource.h>
12#include <math.h> 13#include <math.h>
13#include <signal.h> 14#include <signal.h>
68 signal (SIGURG, sigu); 69 signal (SIGURG, sigu);
69 70
70 for (lp = 0; lp < 1000000; lp++) { 71 for (lp = 0; lp < 1000000; lp++) {
71 s=stamp(); 72 s=stamp();
72 73
73 struct timespec ts; clock_gettime (CLOCK_THREAD_CPUTIME_ID, &ts); 74 //struct timespec ts; clock_gettime (CLOCK_THREAD_CPUTIME_ID, &ts);
74 //printf ("%9ld\n", ts.tv_nsec);//D 75 //printf ("%9ld\n", ts.tv_nsec);//D
75 //struct rusage usage; getrusage (RUSAGE_SELF, &usage); 76 //struct rusage usage; getrusage (RUSAGE_SELF, &usage);
76 //struct tms tms; times (&tms); 77 //struct tms tms; times (&tms);
77 78
78 //kill (0, SIGURG); 79 //kill (0, SIGURG);
80 //read (evfd, &ctr, 8); 81 //read (evfd, &ctr, 8);
81 //write (p[1], &buf, 1); 82 //write (p[1], &buf, 1);
82 //read (p[0], &buf, 4); 83 //read (p[0], &buf, 4);
83 //stat ("/etc/passwd", &sbuf); 84 //stat ("/etc/passwd", &sbuf);
84 //struct timeval tv; gettimeofday (&tv, 0); 85 //struct timeval tv; gettimeofday (&tv, 0);
86 //void *x = mmap (0, 16384, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE,-1,0);
85 87
86 //l = lzf_compress (data, DSIZE, data2, DSIZE*2); 88 l = lzf_compress (data, DSIZE, data2, DSIZE*2);
87 //assert(l); 89 assert(l);
90
91 j = lzf_decompress (data2, l, data3, DSIZE*2);
92 assert (j == DSIZE);
88 93
89 si[0]=measure(s); 94 si[0]=measure(s);
90 95
91 //j = lzf_decompress (data2, l, data3, DSIZE*2); 96 assert (!memcmp (data, data3, DSIZE));
92 //assert (j == DSIZE);
93 97
94 printf ("\r%10d (%d) ", si[0], l); 98 printf ("\r%10d (%d) ", si[0], l);
95 if (si[0] < min && si[0] > 0) 99 if (si[0] < min && si[0] > 0)
96 { 100 {
97 printf ("\n"); 101 printf ("\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines