summaryrefslogtreecommitdiffstats
path: root/SD-VBS/preload-times
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2020-10-23 16:42:53 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-23 16:42:53 -0400
commit3498e3270194093098f9b8275901517fa2f9fa32 (patch)
tree5ce66df0516fa44981da3542115bb307aefb6f65 /SD-VBS/preload-times
parent8e9d3399bbc1249370a4423bce3d1db9e417d952 (diff)
Squashed commit sd-vbs from Leo:
- Fixes SD-VBS build with LITMUS 1 defined - Fixes memory leak in stitch and tracking benchmarks - Adds initial case-study script and configurations
Diffstat (limited to 'SD-VBS/preload-times')
0 files changed, 0 insertions, 0 deletions
alt'>















































































                                                                                                                                   
#include <time.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <limits.h>
#include <../litmus.h>

#define L3_CACHE_SIZE (11264*1024)

#define SAVE_RESULTS if(jobsComplete>-1) progTime[jobsComplete]=(end.tv_nsec-start.tv_nsec)+(1000000000*(end.tv_sec-start.tv_sec));


#define SET_UP char *thisProgram=argv[1];\
	int maxJobs=atoi(argv[2]);\
        char *thisCore=argv[3];\
        char *otherCore=argv[4];\
        char *otherProgram=argv[5];\
        char *runID=argv[6];\
	int output=atoi(argv[7]);\
	struct timespec start, end;\
	int jobsComplete;\
	long progTime[maxJobs*output];\
	char fileName[50];\
	char *bigArray;\
	strcpy(fileName, runID);\
	strcat(fileName, ".txt");\
	mlockall(MCL_CURRENT || MCL_FUTURE);

#define WRITE_TO_FILE if (output){\
	munlockall();\
	FILE *fp=fopen(fileName, "a");\
	for(jobsComplete=0; jobsComplete<maxJobs; jobsComplete++){\
		fprintf(fp, "%s %s %s %s %d %ld %s %d \n",\
		thisProgram, otherProgram, thisCore, otherCore, maxJobs,\
		progTime[jobsComplete], runID, jobsComplete);\
	}\
	fclose(fp);\
	}

#define KILL_CACHE bigArray=(char *)malloc(L3_CACHE_SIZE);\
if (bigArray==NULL) perror("Malloc failed.\n");\
memset(bigArray, 1, L3_CACHE_SIZE);\
munlock(bigArray, L3_CACHE_SIZE);\
free(bigArray);\
bigArray=NULL;



//invoke start timer twice, stop timer to make sure timer and vars are in cache
#define START_TIMER clock_gettime(CLOCK_MONOTONIC, &start);\
        clock_gettime(CLOCK_MONOTONIC, &end);\
	clock_gettime(CLOCK_MONOTONIC, &start);\
		
#define STOP_TIMER clock_gettime(CLOCK_MONOTONIC, &end);


#define START_LOOP START_TIMER

#define STOP_LOOP if (output) {STOP_TIMER SAVE_RESULTS} sleep_next_period();


/*
Intended structure

main
SET_UP
notice that STOP LOOP negates the ++ if outout=0
for (jobsComplete=-1; jobsComplete<maxJobs; jobsComplete++){
		KILL_CACHE
		START_TIMER
		tacleInit();
		tacleMain();
		STOP_TIMER
		SAVE_RESULTS
}
WRITE_TO_FILE
tacleReturn	
*/