Avaliação de Desempenho de Sistemas Lista I Edson Samuel Gonzaga da Silva Júnior esgsj@cin.ufpe.br Aleciano Ferreira Lobo Júnior aflj@cin.ufpe.br Charles Bezerra Moreira cbm3@cin.ufpe.br Ana Carolina Veloso Teixeira acvt@cin.ufpe.br Classify each of the following metrics as being either means based or ends based;,, execution time, bytes of available memory, quality of a final answer, arithmetic precision, system cost, speedup, and reliability of an answer. Means based Clock Rate Quality of a Final Answer System Cost Ends based Execution Time Speedup QUIPS Execution Rate Bytes of Available Memory Arithmetic Precision Reliability of an Answer What are the key differences between wall clock time and CPU time? Under what conditions should each one be used? Is it possible for these two different times to be the same? O termo wall clock time, cuja tradução literal significa tempo do relógio de parede, está relacionado à representação de um período na ordem cronológica a qual se segue no tempo real. Em contraste a este modelo, o conceito de CPU time é atribuído ao tempo de execução de um determinado processo em um ambiente computacional. Neste contexto, o tempo de CPU pode ser diferente do tempo real devido a situações como a alternância de processos (ocasionando a pausa e continuação dos mesmos). Os sistemas operacionais baseados em Unix, por exemplo, fornecem um comando denominado time. Este comando pode ser utilizado para cronometrar a execução de um
programa, o qual se deseja avaliar no ambiente de execução. Ao ser executado, o time informa ao usuário três tipos de tempos diferentes: $timedate DomMai1116:24:06BRT2014 real user sys 0m0.003s 0m0.000s 0m0.002s De acordo com o exemplo acima, o processo foi executado em um tempo real (wall clock) de 3 milissegundos. Além disso, são informados os tempos user e sys, que compreendem respectivos tempos de execução no espaço do usuário e no kernel. Juntos, estes dois tempos definem o CPU time. (a) Write a simple benchmark program to estimate the maximum effective rating of a computer system. Use your program to rank the performance of three different, but roughly comparable, computer systems. usingnamespacestd; #include<stdio.h> #include<stdint.h> #include<sys/timeb.h> intgetmillicount(){ timebtb; ftime(&tb); intncount=tb.millitm+(tb.time& 0xfffff)* 1000; returnncount; intgetmillispan(intntimestart){ intnspan=getmillicount()- ntimestart; if(nspan<0) nspan+=0x100000* 1000; returnnspan; intmain(){ uint64_tquantidade=100000000000; uint64_ti; uint64_tsoma; printf("\n\n**************************************************\n"); printf("*** ***** ** ** *** *************\n");
printf("*** *** ** ** **** *** *******************\n"); printf("*** *** ** ** *** *************\n"); printf("*** **** ** ** *************** *************\n"); printf("*** ***** ** ** ********* *************\n"); printf("**************************************************\n\n"); printf("numerodeinstrucoes:%lu\n\n", quantidade); intstart=getmillicount(); for(i=1; i<quantidade; i++){ soma+=i; intelapsedmillis=getmillispan(start); printf("\n\ntempo \t%u milissegundos\t %f segundos", elapsedmillis, ((float) elapsedmillis/ 1e3)); 1e6); printf("\n\n%.3f ", ((float) (quantidade / ((float) elapsedmillis / 1e3))) / printf("\n\n\n"); printf("pressioneenterparafechar."); getchar(); return1; (b) Repeat part (a) using the maximum effective rating as the metric of performance. usingnamespacestd; #include<stdio.h> #include<stdint.h> #include<sys/timeb.h> intgetmillicount(){ timebtb; ftime(&tb); intncount=tb.millitm+(tb.time& 0xfffff)* 1000; returnncount; intgetmillispan(intntimestart){ intnspan=getmillicount()- ntimestart;
if(nspan<0) nspan+=0x100000* 1000; returnnspan; intmain(){ uint64_tquantidade=100000000000; uint64_ti; floatsoma=0; printf("\n\n************************************************************************\n"); printf("*** ***** ** ** ********* *** *** *****\n"); printf("*** *** ** ******** ******** ****** ** ***** *** ************\n"); printf("*** *** ** ** ******** ****** ** *** *****\n"); printf("*** **** ** ******** ******** ****** ** ***************** *****\n"); printf("*** ***** ** ******** *** *** ********** *****\n"); printf("************************************************************************\n\n"); printf("numerodeinstrucoes:%lu\n\n", quantidade); intstart=getmillicount(); for(i=1; i<quantidade; i++){ soma+=0.001; intelapsedmillis=getmillispan(start); printf("\n\ntempo \t%u milissegundos\t %f segundos", elapsedmillis, ((float) elapsedmillis/ 1e3)); 1e6); printf("\n\n%.3f ", ((float)(quantidade/((float) elapsedmillis/ 1e3)))/ printf("\n\n\n"); printf("pressioneenterparafechar."); getchar(); return1;
(c) Compare the rankings obtained in parts (a) and (b) with the ranking obtained by comparing the clock frequencies of the different systems. Clock Sistema A (Intel Core i5 3320M) 337 198 2601 MHz Sistema B (Intel Core i7 4500U) 362 244 1800 MHz Sistema C (AMD Quad Core 3420M) 201 54 1500 MHz (d) Finally, compare your rankings with those published by authors using some standard benchmark programs, such as those available on the SPEC website. Valores comparados com os benchmarks do software SiSoft Sandra Dhrystone (para ) e Whetstone (para ). Tais benchmarks foram efetuados pelo website NotebookCheck. Sistema A (Intel Core i5 3320M) 337 198 Sistema A (Intel Core i5 3320M) SiSoft Sandra 57674 38286 Sistema B (Intel Core i7 4500U) 362 244 Sistema B (Intel Core i7 4500U) SiSoft Sandra 53817 34315 Sistema C (AMD Quad Core 3420M) 201 54 Sistema C (AMD Quad Core 3420M) SiSoft Sandra 11130 9250