diff options
Diffstat (limited to 'spewG.c')
-rw-r--r-- | spewG.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -0,0 +1,39 @@ | |||
1 | |||
2 | /* spew out a thoroughly gigantic file designed so that bzip2 | ||
3 | can compress it reasonably rapidly. This is to help test | ||
4 | support for large files (> 2GB) in a reasonable amount of time. | ||
5 | I suggest you use the undocumented --exponential option to | ||
6 | bzip2 when compressing the resulting file; this saves a bit of | ||
7 | time. Note: *don't* bother with --exponential when compressing | ||
8 | Real Files; it'll just waste a lot of CPU time :-) | ||
9 | (but is otherwise harmless). | ||
10 | */ | ||
11 | |||
12 | #define _FILE_OFFSET_BITS 64 | ||
13 | |||
14 | #include <stdio.h> | ||
15 | #include <stdlib.h> | ||
16 | |||
17 | /* The number of megabytes of junk to spew out (roughly) */ | ||
18 | #define MEGABYTES 5000 | ||
19 | |||
20 | #define N_BUF 1000000 | ||
21 | char buf[N_BUF]; | ||
22 | |||
23 | int main ( int argc, char** argv ) | ||
24 | { | ||
25 | int ii, kk, p; | ||
26 | srandom(1); | ||
27 | setbuffer ( stdout, buf, N_BUF ); | ||
28 | for (kk = 0; kk < MEGABYTES * 515; kk+=3) { | ||
29 | p = 25+random()%50; | ||
30 | for (ii = 0; ii < p; ii++) | ||
31 | printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ); | ||
32 | for (ii = 0; ii < p-1; ii++) | ||
33 | printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" ); | ||
34 | for (ii = 0; ii < p+1; ii++) | ||
35 | printf ( "ccccccccccccccccccccccccccccccccccccc" ); | ||
36 | } | ||
37 | fflush(stdout); | ||
38 | return 0; | ||
39 | } | ||