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