mirror of https://github.com/lindes/ttyload.git
first pass at a load-generating program. works, but needs to be
parameterized for happiness.
This commit is contained in:
parent
dd93ba15d2
commit
76af8d3b3d
|
@ -1 +1,2 @@
|
|||
ttyload
|
||||
loader
|
||||
|
|
2
Makefile
2
Makefile
|
@ -18,7 +18,7 @@ VERSION = -DVERSION='"'`cat Version`'"'
|
|||
|
||||
CFLAGS = $(INCLUDES) $(OTHER_FLAGS) $(DEBUG) $(VERSION)
|
||||
|
||||
default: archbuild
|
||||
default: archbuild loader
|
||||
|
||||
test: archbuild
|
||||
./ttyload -i 1
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv)
|
||||
{
|
||||
int ttl, /* how long to load things */
|
||||
forks; /* how many jobs to run at once */
|
||||
time_t start; /* when we started */
|
||||
pid_t pid; /* return value for fork() */
|
||||
|
||||
/* for now, set these purely by hand... later, I'll
|
||||
* make 'em be based on argv. */
|
||||
|
||||
ttl = 90;
|
||||
forks = 11; /* this one goes to 11. ;-) */
|
||||
|
||||
for(/*pre-initted*/; --forks > 0 ;)
|
||||
{
|
||||
if(pid = fork())
|
||||
break; /* don't continue this loop as child. */
|
||||
}
|
||||
|
||||
printf("Bomb running for %d seconds\n", ttl);
|
||||
|
||||
start = time(NULL);
|
||||
|
||||
while(time(NULL) < (start + ttl))
|
||||
{
|
||||
; /* do nothing, tight loop is intentional. */
|
||||
}
|
||||
|
||||
printf("Bomb ending at %ld, started %ld\n", time(NULL), start);
|
||||
|
||||
exit(0);
|
||||
}
|
Loading…
Reference in New Issue