From 959a8480975c4af652a18fc914db743ee328c030 Mon Sep 17 00:00:00 2001 From: Peter Ludikovsky Date: Mon, 11 Feb 2019 13:06:53 +0100 Subject: Initial version --- .gitignore | 2 + LICENSE | 11 ++++++ stress.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ stress.h | 27 +++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 stress.c create mode 100644 stress.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8164476 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +stress +.*.swp diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..146ff70 --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright 2019 Peter Ludikovsky + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/stress.c b/stress.c new file mode 100644 index 0000000..0b7e999 --- /dev/null +++ b/stress.c @@ -0,0 +1,125 @@ +#include "stress.h" + +void usage(void) +{ + printf("Usage: stress [-t n] [-m n]\n"); + printf("\t-t n\tRun n processes parallel\n"); + printf("\t-m n\tTest n MiB of Memory\n"); + printf("\n"); + printf("\t\tCan be combined\n"); + exit(0); +} + +void testMemory(unsigned long long size) +{ + char *mem=malloc(size*sizeof(char)); + unsigned long long i; + unsigned char run=0; + + while(1==1) + { + for(i=0; i0) + { + usage(); + } + if(optflags & THREADS) + { + printf("Threads: %d\n", threads); + } + if(optflags & MEMSIZE) + { + printf("Memsize: %llu\n", memory); + } + + for(i=0; i +#include +#include +#include +#include +#include +#include +#include +extern int errno; + +#ifndef LDBL_MAX +#define LDBL_MAX __LDBL_MAX__ +#endif + +#ifndef LDBL_EPSILON +#define LDBL_EPSILON __LDBL_EPSILON__ +#endif + +#define THREADS 0x1 +#define MEMSIZE 0x2 + +void testCPU(void); +void testMemory(unsigned long long); +void usage(void); +#endif -- cgit v1.2.3