Exemplo n.º 1
0
Arquivo: proc.c Projeto: 08opt/linux
static int show_cpuinfo(struct seq_file *m, void *v)
{
	int n = ptr_to_cpu(v);

	if (n == 0) {
		char buf[NR_CPUS*5];
		cpulist_scnprintf(buf, sizeof(buf), cpu_online_mask);
		seq_printf(m, "cpu count\t: %d\n", num_online_cpus());
		seq_printf(m, "cpu list\t: %s\n", buf);
		seq_printf(m, "model name\t: %s\n", chip_model);
		seq_printf(m, "flags\t\t:\n");  /* nothing for now */
		seq_printf(m, "cpu MHz\t\t: %llu.%06llu\n",
			   get_clock_rate() / 1000000,
			   (get_clock_rate() % 1000000));
		seq_printf(m, "bogomips\t: %lu.%02lu\n\n",
			   loops_per_jiffy/(500000/HZ),
			   (loops_per_jiffy/(5000/HZ)) % 100);
	}

#ifdef CONFIG_SMP
	if (!cpu_online(n))
		return 0;
#endif

	seq_printf(m, "processor\t: %d\n", n);

	/* Print only num_online_cpus() blank lines total. */
	if (cpumask_next(n, cpu_online_mask) < nr_cpu_ids)
		seq_printf(m, "\n");

	return 0;
}
Exemplo n.º 2
0
void __init calibrate_delay(void)
{
	loops_per_jiffy = get_clock_rate() / HZ;
	pr_info("Clock rate yields %lu.%02lu BogoMIPS (lpj=%lu)\n",
		loops_per_jiffy/(500000/HZ),
		(loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);
}
Exemplo n.º 3
0
/* Wait until this PTE has completed migration. */
static void wait_for_migration(pte_t *pte)
{
	if (pte_migrating(*pte)) {
		/*
		 * Wait until the migrater fixes up this pte.
		 * We scale the loop count by the clock rate so we'll wait for
		 * a few seconds here.
		 */
		int retries = 0;
		int bound = get_clock_rate();
		while (pte_migrating(*pte)) {
			barrier();
			if (++retries > bound)
				panic("Hit migrating PTE (%#llx) and page PFN %#lx still migrating",
				      pte->val, pte_pfn(*pte));
		}
	}
}
Exemplo n.º 4
0
int gxio_mpipe_get_timestamp(gxio_mpipe_context_t *context,
			     struct timespec *ts)
{
	int ret;
	cycles_t cycles_prev, cycles_now, clock_rate;
	cycles_prev = get_cycles();
	ret = gxio_mpipe_get_timestamp_aux(context, (uint64_t *)&ts->tv_sec,
					   (uint64_t *)&ts->tv_nsec,
					   (uint64_t *)&cycles_now);
	if (ret < 0) {
		return ret;
	}

	clock_rate = get_clock_rate();
	ts->tv_nsec -= (cycles_now - cycles_prev) * 1000000000LL / clock_rate;
	if (ts->tv_nsec < 0) {
		ts->tv_nsec += 1000000000LL;
		ts->tv_sec -= 1;
	}
	return ret;
}
Exemplo n.º 5
0
Arquivo: mttest.c Projeto: dhaley/dcp
int
main(int argc, char **argv, char **envp)
{
	int	i;

	scale_init(argc, argv);

#define ALIGNMENTOFFSET 2 /* adjust alignment */
        i = sizeof(workStruct_t)*
            (narrays+ALIGNMENTOFFSET);
        element = memalign(64, i);
	if ( element == NULL ) {
	    perror("calloc( narrays, sizeof(workStruct_t) )");
	    exit(1);
	}
        compute_set(element);
        memset(element, 0, i);
        element+=ALIGNMENTOFFSET;

#ifdef SELFTEST
	start_prof();
#endif

	fid = open_output("mttest.acct");
	if (job_index == -1) {
		i = (sizeof(scripttab)/sizeof( struct scripttab) -1 );
	} else {
		i = 1;
	}
	fprintf(fid, "Number of tests: %d  Repeat count: %d\n",
		i, repeat_count);

	fprintf(fid, "MHz: %d\n", get_clock_rate() );

	fprintf(fid,
	    "X    Incl. Total   Incl. CPU   Incl. Sync. Wait   Name (%s)\n",
		model);
	fflush(fid);
  
	name = strdup(argv[0]);

	init_micro_acct();
#if OS(Solaris) 
	if(uniprocessor != 0) {
	    /* call processor_bind to force single CPU */
	    processor_bind(P_PID, P_MYID, cpuid, NULL);
	}
#endif /* OS(Solaris) */

#ifdef SOLARIS
	sema_init(&global_sema_lock, count, USYNC_THREAD, NULL);
#endif
#ifdef POSIX
	pthread_attr_init(&attr);

    #ifdef BOUND
	pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
    #endif

	sem_init(&global_sema_lock, 0, count);
#endif

#if 0
	if ((s5_sema_id = semget(IPC_PRIVATE, 1, 0600)) == -1)
		perror("semget: IPC_PRIVATE");

	arg.val = count;
	if (semctl(s5_sema_id, 0, SETVAL, arg) == -1)
		perror("semctl: SETVAL");
#endif

	resolve_symbols();

	i = locktest();
#if 0
	if (semctl(s5_sema_id, 0, IPC_RMID) == -1)
		perror("semctl: IPC_RMID");
#endif

	close_file(fid);

#ifdef SELFTEST
        finish_prof();
#endif

	return 0;
}