Exemple #1
0
void nth_desc_eslist_init ( nth_desc_eslist_t *l)
{
    l->first = NULL;
    l->last = NULL;
    l->nths = 0;
    nth_spin_init(&l->mutex);
}
Exemple #2
0
void nth_instrument_init (char *basename)
{
	printf("Nth instrumentation enabled\n");

	/* env init */
	char *options = getenv("NTH_INSTRUMENT");
	if (options) {
		char *opt,*next,*value;

		next = options;
		while (next) {
			opt = next;
			next = strchr(opt,',');
			if (next) *next++=0;

			value = strchr(opt,'=');
			if ( value ) *value++=0;
			
			if ( !strcasecmp(opt,"maxlevel") ) {
				if (value)
					mintaka_max_level = atoi(value);
				else // TODO: warning
					;
			}
		}
	}


	/* mintaka initialization */
	mintaka_app_begin();
	mintaka_set_filebase(basename);
	nth_spin_init(&mintaka_lock);

/* FIXME: Registering some events... to-check */
#if 0
        /* register some events used by mercurium */
        mintaka_index_event(NTH_EVENT_CALL_USER_FUNCTION, NTH_EVENT_CALL_USER_FUNCTION_DESCR);
        mintaka_index_event(NTH_EVENT_TASK_ENQUEUE, NTH_EVENT_TASK_ENQUEUE_DESCR);

        /* register some events used by nanos library */
        mintaka_index_event(NTH_EVENT_PARALLEL, NTH_EVENT_PARALLEL_DESCR);
        mintaka_index_event_value(NTH_EVENT_PARALLEL, 1, NTH_EVENT_PARALLEL_1_DESCR);
        mintaka_index_event_value(NTH_EVENT_PARALLEL, 2, NTH_EVENT_PARALLEL_2_DESCR);
        mintaka_index_event_value(NTH_EVENT_PARALLEL, 3, NTH_EVENT_PARALLEL_3_DESCR);

        mintaka_index_event(NTH_EVENT_WORKSHARING, NTH_EVENT_WORKSHARING_DESCR);
        mintaka_index_event_value(NTH_EVENT_WORKSHARING, 1, NTH_EVENT_WORKSHARING_1_DESCR);
        mintaka_index_event_value(NTH_EVENT_WORKSHARING, 2, NTH_EVENT_WORKSHARING_2_DESCR);
        mintaka_index_event_value(NTH_EVENT_WORKSHARING, 3, NTH_EVENT_WORKSHARING_3_DESCR);

        /* register some events used by nanos library */
        mintaka_index_event(NTH_EVENT_PROGRAM, NTH_EVENT_PROGRAM_DESCR);
        mintaka_index_event_value(NTH_EVENT_PROGRAM, 1, NTH_EVENT_PROGRAM_1_DESCR);

        mintaka_index_event(NTH_EVENT_CREATE, NTH_EVENT_CREATE_DESCR);
        mintaka_index_event_value(NTH_EVENT_CREATE, 1, NTH_EVENT_CREATE_1_DESCR);

        mintaka_index_event(NTH_EVENT_BLOCK, NTH_EVENT_BLOCK_DESCR);
        mintaka_index_event_value(NTH_EVENT_BLOCK, 1, NTH_EVENT_BLOCK_1_DESCR);

        mintaka_index_event(NTH_EVENT_TASK_BLOCK, NTH_EVENT_TASK_BLOCK_DESCR);
        mintaka_index_event_value(NTH_EVENT_TASK_BLOCK, 1, NTH_EVENT_TASK_BLOCK_1_DESCR);

        mintaka_index_event(NTH_EVENT_BARRIER, NTH_EVENT_BARRIER_DESCR);
        mintaka_index_event_value(NTH_EVENT_BARRIER, 1, NTH_EVENT_BARRIER_1_DESCR);

        mintaka_index_event(NTH_EVENT_YIELD, NTH_EVENT_YIELD_DESCR);
        mintaka_index_event_value(NTH_EVENT_YIELD, 1, NTH_EVENT_YIELD_1_DESCR);
#endif

	/* event registration (if needed) */
	mintaka_index_event(EVENT_NTH_CREATION,"Nano-thread creation");
	mintaka_index_event(EVENT_NTH_EXIT,"Nano-thread exit");
	mintaka_index_event(EVENT_TASK_CREATION,"Task creation");
	mintaka_index_event(EVENT_TASK_EXIT,"Task exit");
	mintaka_index_event(EVENT_TASK_INLINED,"Task was executed immediately");
	mintaka_index_event(EVENT_NTH_DEPTH,"Nano-thread depth");
	mintaka_index_event(EVENT_TASK_ID,"Executing nth id");
        mintaka_index_event(EVENT_USER_FUNCTION,"User function entry");
	mintaka_index_event(EVENT_NTH_SYNC,"Nth sync event");

	nth_instrument_in_runtime();
}