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

Comparing liblzf/bench.c (file contents):
Revision 1.10 by root, Fri May 1 00:30:53 2009 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>
9#include <sys/stat.h> 10#include <sys/stat.h>
11#include <sys/resource.h>
10#include <math.h> 12#include <math.h>
11#include <signal.h> 13#include <signal.h>
12#include <X11/Xlib.h> 14#include <X11/Xlib.h>
13 15
14#include "lzf.h" 16#include "lzf.h"
63 fread (data, DSIZE, 1, f); 65 fread (data, DSIZE, 1, f);
64 fclose (f); 66 fclose (f);
65 67
66 signal (SIGURG, sigu); 68 signal (SIGURG, sigu);
67 69
68 for (lp = 0; lp < 100000; lp++) { 70 for (lp = 0; lp < 1000000; lp++) {
69 s=stamp(); 71 s=stamp();
70 72
71 //snprintf (buf, 64, "<1.%llx>", (unsigned long long)0xa234567812ULL); 73 struct timespec ts; clock_gettime (CLOCK_THREAD_CPUTIME_ID, &ts);
72 getpgrp(); 74 //printf ("%9ld\n", ts.tv_nsec);//D
75 //struct rusage usage; getrusage (RUSAGE_SELF, &usage);
76 //struct tms tms; times (&tms);
77
73 //kill (0, SIGURG); 78 //kill (0, SIGURG);
74 //write (evfd, &ctr, 8); 79 //write (evfd, &ctr, 8);
75 //read (evfd, &ctr, 8); 80 //read (evfd, &ctr, 8);
76 //write (p[1], &buf, 1); 81 //write (p[1], &buf, 1);
77 //read (p[0], &buf, 4); 82 //read (p[0], &buf, 4);
78 //stat ("/etc/passwd", &sbuf); 83 //stat ("/etc/passwd", &sbuf);
79 //struct timeval tv;
80 //gettimeofday (&tv, 0); 84 //struct timeval tv; gettimeofday (&tv, 0);
81 85
82 l = lzf_compress (data, DSIZE, data2, DSIZE*2); 86 //l = lzf_compress (data, DSIZE, data2, DSIZE*2);
83 assert(l); 87 //assert(l);
84 88
85 si[0]=measure(s); 89 si[0]=measure(s);
86 90
87 j = lzf_decompress (data2, l, data3, DSIZE*2); 91 //j = lzf_decompress (data2, l, data3, DSIZE*2);
88 assert (j == DSIZE); 92 //assert (j == DSIZE);
89 93
90 printf ("\r%10d (%d) ", si[0], l); 94 printf ("\r%10d (%d) ", si[0], l);
91 if (si[0] < min && si[0] > 0) 95 if (si[0] < min && si[0] > 0)
92 { 96 {
93 printf ("\n"); 97 printf ("\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines