示例#1
0
clock_t sched_timing_get(struct schedee *s) {
	clock_t running = s->sched_timing.running_time;

	if (sched_active(s))
		/* Add the least recent time slice (being used now). */
		running += clock() - s->sched_timing.last_sync;

	return running;
}
示例#2
0
文件: whereami.c 项目: Julia117/embox
static size_t tb_snprint_thread_state(char *buff, size_t buff_sz,
		struct thread *t) {
	char *p = buff;
	char *end = buff + buff_sz;
	int is_current = (t == thread_self());

	p += tb_safe_snprintf(p, end-p,
		" --   %08x %c %c %c %c  thread %d  task %d ",
		t->critical_count,
		is_current      ? '*' : ' ',
		sched_active(&t->schedee) ? 'A' : ' ',
		t->schedee.ready        ? 'R' : ' ',
		t->schedee.waiting      ? 'W' : ' ',
		t->id, task_get_id(t->task));

	memset(p, '-', end-p-1);
	*(end-1) = '\0';

	return buff_sz;
}