« Random ranging… | Main | Disk Recovery Software »
My first production C program…
By Matt | October 30, 2009
Took the class like six years ago but never had a need to actually put any code in production best I can remember.
Shell was taking, at best I could optimize it, 13 hours to create the files I needed…with C I can do it in a about 5 minutes. Wow. It’s a really simple program designed to make many (millions if necessary) entries in a file that http_load then uses to randomly pick URLs from.
sequential.c:
#include <stdio.h> #include <stdlib.h> #include <time.h>
int
main (int argc, char *argv[])
{
int q; q = atoi(argv[2]);
while (( q <= atoi(argv[4]) ))
{
printf ("%s%u\n", argv[1], q);
q = q + atoi(argv[3]);
}
return 0; }
Usage example:
./sequential http://192.168.7.148:9101/raid_1/75K_File_ 1 64 214748364 > sequential_test_urls
Which writes a file that starts with: http://192.168.7.148:9101/raid_1/75K_File_1 http://192.168.7.148:9101/raid_1/75K_File_65 ... http://192.168.7.148:9101/raid_1/75K_File_214748289 http://192.168.7.148:9101/raid_1/75K_File_214748353
Multiple instances of sequential can be used, with different starting numbers, to divide the workload amount multiple http_loads each calling a different url load file.
Topics: Uncategorized | No Comments »
Comments
You must be logged in to post a comment.