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.10 by root, Fri May 1 00:30:53 2009 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines