Update of /cvsroot/linux-hls/hls/simul/loads
In directory sc8-pr-cvs1:/tmp/cvs-serv20402/simul/loads
Added Files:
continuous.c periodic.c standard.c
Log Message:
- Some work in the workload generator
- New docs directory + doc about my power management proposal
--- NEW FILE: continuous.c ---
#include <stdio.h>
#include <stdlib.h>
#include "interface-data.h"
#include "os.h"
#include "sim.h"
#include "event.h"
#define TH_FIXED_PRIO 3 /* FIXME: What do we want to do here??? */
int total_num_threads;
extern long long int max_res_time;
extern long long int max_run_time_until_blocking;
extern long long int cpu_time_per_thread;
extern long long int max_blocking_time;
long long int execution_time(void)
{
return 10000;
}
long long int workload_generate(void)
{
int EndNumProcessors;
int threads;
int i;
EndNumProcessors = 1;
threads = 10;
total_num_threads = 20;
sim_printf("simulating %d threads\n", threads);
#if 0
max_run_time_until_blocking = ((long long int)(sim_rand()%1000000))+500;
max_blocking_time = ((long long int)(sim_rand()%100000))+500;
max_res_time = 100000000;
cpu_time_per_thread = /*HLS_MsToNT * 500*/ /*1000000*/ 500000;
#endif
for(i = 0; i < threads; i++) {
make_new_thread(100, 0, /*execution_time*/ NULL, NULL, TH_FIXED_PRIO);
}
{
struct sim_event *e;
long long int tt = 0;
for (i = 1; i < EndNumProcessors; i++) {
e = new_event(EVENT_TYPE_NEW_PROC, 0);
tt += sim_rand() % 500000;
insert_event (e, tt);
}
}
#if 0
e = new_event (EVENT_TYPE_MOVETOPS, 0);
insert_event (e, (long long int)(sim_rand()%100000));
#endif
#if 0
e = new_event (EVENT_TYPE_LOADRES, 0);
insert_event (e, (long long int)(sim_rand()%10000000));
#endif
return 100000000;
}
--- NEW FILE: periodic.c ---
#include <stdio.h>
#include <stdlib.h>
#include "interface-data.h"
#include "os.h"
#include "sim.h"
#include "event.h"
#define TH_FIXED_PRIO 3 /* FIXME: What do we want to do here??? */
int total_num_threads;
extern long long int max_res_time;
extern long long int cpu_time_per_thread;
extern long long int max_blocking_time;
long long int execution_time(void)
{
return 2000000;
}
long long int period(void)
{
return 100000000;
}
long long int workload_generate(void)
{
int EndNumProcessors;
int threads;
int i;
EndNumProcessors = 1;
threads = 10;
total_num_threads = 20;
sim_printf("simulating %d threads\n", threads);
#if 0
max_blocking_time = ((long long int)(sim_rand()%100000))+500;
max_res_time = 100000000;
cpu_time_per_thread = /*HLS_MsToNT * 500*/ /*1000000*/ 500000;
#endif
for(i = 0; i < threads; i++) {
make_new_thread(100, 0, execution_time, period, TH_FIXED_PRIO);
}
{
struct sim_event *e;
long long int tt = 0;
for (i = 1; i < EndNumProcessors; i++) {
e = new_event(EVENT_TYPE_NEW_PROC, 0);
tt += sim_rand() % 500000;
insert_event (e, tt);
}
}
#if 0
e = new_event (EVENT_TYPE_MOVETOPS, 0);
insert_event (e, (long long int)(sim_rand()%100000));
#endif
#if 0
e = new_event (EVENT_TYPE_LOADRES, 0);
insert_event (e, (long long int)(sim_rand()%10000000));
#endif
return 1000000000;
}
--- NEW FILE: standard.c ---
#include <stdio.h>
#include <stdlib.h>
#include "interface-data.h"
#include "os.h"
#include "sim.h"
#include "event.h"
#define TH_FIXED_PRIO 3 /* FIXME: What do we want to do here??? */
static long long int MAX_TIME_UNTIL_DISPATCH_INTERRUPT;
static long long int MAX_TIME_UNTIL_IDLE_CHECK;
int total_num_threads;
long long int max_time_until_quit;
extern long long int max_res_time;
extern long long int max_run_time_until_blocking;
extern long long int cpu_time_per_thread;
extern long long int max_blocking_time;
void workload_generate(void)
{
int EndNumProcessors;
int NUM_THREADS;
int i;
#if 0
EndNumProcessors = (sim_rand() % 3) + 3;
#else
EndNumProcessors = 1;
#endif
NUM_THREADS = (sim_rand() % 25) + 250;
total_num_threads = 10 + (sim_rand() % 30);
/*
sim_printf ("simulating %d processors and %d threads\n",
EndNumProcessors, NUM_THREADS);
*/
sim_printf ("simulating %d threads\n", NUM_THREADS);
// FIXME: make the simulator create and destroy lots of threads
// have a max num of threads and create more when current is
// less than this
max_run_time_until_blocking = ((long long int)(sim_rand()%1000000))+500;
max_blocking_time = ((long long int)(sim_rand()%100000))+500;
max_time_until_quit = ((long long int)(sim_rand()%10000));
MAX_TIME_UNTIL_DISPATCH_INTERRUPT = (sim_rand()%50000)+50;
MAX_TIME_UNTIL_IDLE_CHECK = (sim_rand()%50000)+50;
max_res_time = 100000000;
cpu_time_per_thread = /*HLS_MsToNT * 500*/ /*1000000*/ 500000;
for(i = 0; i < NUM_THREADS; i++) {
make_new_thread((long long int)((sim_rand() % 10000) + 1000), cpu_time_per_thread, /* max_run_time_until_blocking */0,
TH_FIXED_PRIO);
}
{
struct sim_event *e;
long long int tt = 0;
for (i = 1; i < EndNumProcessors; i++) {
e = new_event(EVENT_TYPE_NEW_PROC, 0);
tt += sim_rand() % 500000;
insert_event (e, tt);
}
}
#if 0
e = new_event (EVENT_TYPE_MOVETOPS, 0);
insert_event (e, (long long int)(sim_rand()%100000));
#endif
#if 0
e = new_event (EVENT_TYPE_LOADRES, 0);
insert_event (e, (long long int)(sim_rand()%10000000));
#endif
}
|