Exemplo n.º 1
0
void affinity_set::print_affinity(int id, const char* s)
{
    if (get_affinity() == 0)
        print_set(id, s);
    else
        printf("Error in sched_getaffinity\n");

}
Exemplo n.º 2
0
        static void* ThreadHandler(void* arg)
        {
            DSPThread* thread = static_cast<DSPThread*>(arg);
            
            AVOIDDENORMALS;
            get_affinity(thread->fThread);

            // One "dummy" cycle to setup thread
            if (thread->fRealTime) {
                thread->Run();
                SetRealTime();
            }
                      
            while (true) {
                thread->Run();
            }
            
            return NULL;
        }
Exemplo n.º 3
0
Arquivo: main.c Projeto: MigNov/mBench
int main(int argc, char *argv[])
{
	int flags;
	unsigned long long start = 0;

	start = nanotime();

	results = (tResults *)malloc( sizeof(tResults) );
	memset(results, 0, sizeof(tResults));

	flags = parse_args(argc, argv);
	if ((flags & FLAG_NETS_STAT) && (flags & FLAG_NETC_STAT)) {
		fprintf(stderr, "Error: Cannot use network client and network server together!\n");
		return 1;
	}

	if (flags & FLAG_CA_GET)
		get_affinity();
	if (flags & FLAG_CPU_GET) {
		uint32_t proc;
		proc = cpu_get_count();

		results->cpu_online = PROCESSOR_COUNT_ONLINE(proc);
		results->cpu_total  = PROCESSOR_COUNT_TOTAL(proc);

		DPRINTF("Processors: %d total / %d online\n", PROCESSOR_COUNT_TOTAL(proc),
				PROCESSOR_COUNT_ONLINE(proc));
	}
	if (flags & FLAG_CPU_SPEED) {
		results->cpu_speed = cpu_get_speed_mhz();

		DPRINTF("Measured CPU Speed is: %.*f Mhz\n", prec, cpu_get_speed_mhz());
	}
	if (flags & FLAG_CPU_DHRYSTONE) {
		unsigned long dhrystone, loops, btime;
		cpu_dhrystone_get(&dhrystone, &loops, &btime);

		results->cpu_dhrystone = (float)dhrystone / 1757;

		DPRINTF("Dhrystone: %.*f DMIPS(*), loops: %lu, benchmark time: %ld\n", prec, (float)dhrystone / 1757, loops, btime);
		DPRINTF("* Calculated as dhrystone store divided by 1757 (see: http://en.wikipedia.org/wiki/Dhrystone)\n");
	}
	if (flags & FLAG_CPU_WHETSTONE) {
		unsigned long loops, iter, btime, mips;

		cpu_whetstone_get(&loops, &iter, &btime, &mips);

		results->cpu_whetstone = mips;

		DPRINTF("Whetstone: %lu MIPS, loops: %lu, iteration count: %ld, benchmark time: %ld sec\n", mips, loops, iter, btime);
	}
	if (flags & FLAG_CPU_LINPACK) {
		unsigned long memory;
		float minMFLOPS, maxMFLOPS, avgMFLOPS;

		get_linpack_score(lpArrSize, &memory, &minMFLOPS, &maxMFLOPS, &avgMFLOPS);

		results->cpu_linpack_size = lpArrSize;
		results->cpu_linpack_mem = memory;
		results->cpu_linpack_min = minMFLOPS;
		results->cpu_linpack_max = maxMFLOPS;
		results->cpu_linpack_avg = avgMFLOPS;

		DPRINTF("Linpack array size: %dx%d, memory %ld KB, MFLOPS: min=%.*f, max=%.*f, average=%.*f\n", lpArrSize, lpArrSize,
				memory >> 10, prec, minMFLOPS, prec, maxMFLOPS, prec, avgMFLOPS);
		DPRINTF("* For more information about LINPACK benchmarking see http://en.wikipedia.org/wiki/Linpack\n");
	}