Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1261 → Rev 1262

/demos/trunk/loader/loadfile/load.fsf
53,7 → 53,7
[0]:[0][3000]:[0][10000]:[0][3000]:[0][10000]:[0]:POSIX;
[1]:[0][6000]:[0][30000]:[0][6000]:[0][30000]:[0]:POSIX;
[2]:[0][3000]:[0][30000]:[0][3000]:[0][30000]:[0]:POSIX;
[3]:[0][6000]:[0][30000]:[0][6000]:[0][30000]:[0]:POSIX;
[3]:[0][6000]:[0][30000]:[0][6000]:[0][30000]:[0]:EDF;
 
END
 
68,7 → 68,7
BT:[2]:POSIX:[1]:[0][0]:[0][0]:ACT_SINGLE([5][0]):
:EXEC_CONST([0][16000]):NO_CRIT;
 
CT:[3]:POSIX:[1]:[0][0]:[0][0]:ACT_MEAN([1][0],[0][10000],[0][1000]):
:EXEC_MEAN([0][20000],[0][10000]):NO_CRIT;
CT:[3]:EDF:[10]:[1][0]:[0][100000]:ACT_SINGLE([1][0]):
:EXEC_CONST([0][20000]):NO_CRIT;
 
END
/demos/trunk/loader/common/nload.c
31,12 → 31,18
{
long long i,exec_cycles = 0;
struct loader_task *l = (struct loader_task *)(arg);
char tmp[20];
#ifdef TASK_OUTPUT
#ifdef OS_SHARK
char tmp[20];
#endif
#endif
 
if (l->act_current == 0) l->act_current = 1;
#ifdef TASK_OUTPUT
sprintf(tmp,"[ONESHOT]");
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#ifdef OS_SHARK
sprintf(tmp,"[ONESHOT]");
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#endif
#endif
 
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
64,15 → 70,22
long long i,exec_cycles = 0;
int act = 0;
struct loader_task *l = (struct loader_task *)(arg);
char tmp[20];
 
#ifdef TASK_OUTPUT
#ifdef OS_SHARK
char tmp[20];
#endif
#endif
 
if (l->act_current == 0) l->act_current = 1;
 
while(1) {
 
#ifdef TASK_OUTPUT
sprintf(tmp,"C[%06d]",act);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#ifdef OS_SHARK
sprintf(tmp,"C[%06d]",act);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#endif
#endif
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
105,7 → 118,11
long long i,exec_cycles = 0;
int act = 0;
struct loader_task *l = (struct loader_task *)(arg);
char tmp[20];
#ifdef TASK_OUTPUT
#ifdef OS_SHARK
char tmp[20];
#endif
#endif
 
if (l->act_current == 0) l->act_current = 1;
 
112,8 → 129,10
while(1) {
 
#ifdef TASK_OUTPUT
sprintf(tmp,"B[%06d]",act);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#ifdef OS_SHARK
sprintf(tmp,"B[%06d]",act);
printf_xy((get_current_exec_task() % 5) * 9 + 34,get_current_exec_task() / 5 + 5, GREEN, tmp);
#endif
#endif
exec_cycles = (long long)(TIMESPEC2USEC(&l->exec[l->act_current-1])) * CALIBRATION_DELTA / cal_cycles;
149,16 → 168,6
switch(current->task_type) {
case PAR_TASK_OS:
 
/* generic_task_create(
server number,
pthread_t of created task (-1 if failed),
pthread_attr_t,
task_body,
arg of the body (must be "(void *)current"),
arg for real-time task specification)
*/
 
err = generic_create_thread(generic_get_server_from_contract(current->contract),&j,NULL,
oneshot_task,(void *)current,generic_get_task_model(current));
break;
/demos/trunk/loader/shark/func.h
4,18 → 4,83
#include "kernel/kern.h"
#include "shark.h"
 
#define OS_SHARK
 
#define get_current_exec_task() exec_shadow
/* Return the PID/pthread_t of calling task */
 
#define generic_get_server_from_contract get_server_from_contract
/* Return the server_id from the contract number used
* inside .fsf file to define contract parameters
*
* generic_get_server_from_contract(int contract_number) */
 
#define generic_create_thread fsf_create_thread
/* Create a task/thread inside a specific server.
* it's very similar to fsf_create_thread, but we need a parameter
* to set the local scheduler task and actually it's outside
* the framework
*
* generic_task_create(
* server number,
* pthread_t of created task (-1 if failed),
* pthread_attr_t,
* task_body,
* arg of the body (must be "(void *)current"),
* arg for real-time task specification)
*/
 
#define generic_calibrate_cycle calibrate_cycle
/* Set the calibration parameter "cal_cycle"
* only if it's initialized to 0. The calibration routine
* calculates cal_cycle from CALIBRATION_DELTA.
* This step can also be performed outside the demo.
* Inside calibrate.h you can set the calibration parameters
* for calibration step performed outside.
*
* cal_cycle is the number of cycles that are needed to
* make CALIBRATION_DELTA number of iteration.
*
* kern_cli();
* kern_gettime(&start);
* for (i=0;i<CALIBRATION_DELTA;i++)
* __asm__ __volatile__ ("xorl %%eax,%%eax\n\t"
* "cpuid\n\t"
* :::"eax","ebx","ecx","edx");
* kern_gettime(&end);
* kern_sti();
*
* SUBTIMESPEC(&end,&start,&diff);
* cal_cycles = TIMESPEC2USEC(&diff);
*
*/
 
#define generic_set_next_activation set_next_activation
/* Set the next activation time. It's like fsf_schedule_next_timed_job
* but it don't return nothing
*/
 
#define generic_set_simulation_time set_simulation_time
/* Set the end time of simulation */
 
#define generic_get_task_model get_task_model
/* Return a pointer to the struct that contains the
* local shceduler parameter */
 
#define generic_start_simulation start_simulation
/* Start the simulation */
 
#define generic_fsfinit() fsfinit()
/* Create the fsf_server */
 
#define generic_task_endcycle() task_endcycle()
/* The job is finished */
 
#define generic_end_simulation() sys_end()
/* Exit from simulation */
 
#define printf cprintf
/* Printf standard function */
 
#endif