rarvesa_vga
rarvesa_vga.rar
/* testsum.c: Program to time assembler vs. C implementations of
?*?????? array summation code.
?* Copyright (C) 1991 by Nicholas Wilt.? All rights reserved.
?*/
#include "testfpu.h"
int
main(int argc, char *argv[])
{
? struct time beg, end;
? double x;
? int y;
? double ret;
? long i;
? int j;
? long dead, slow, fast;
? long numreps;
? float *summe;
? int arrsize;
? if (argc != 3) {
??? fprintf(stderr, "Usage: testsum #iters #elems\n");
??? fprintf(stderr, "\t#iters = number of iterations of test\n");
??? fprintf(stderr, "\t#elems = number of elements in arrays\n");
??? exit(1);
? }
? else {
??? char *sc;
??? numreps = strtol(argv[1], &sc, 10);
??? arrsize = atoi(argv[2]);
? }
? summe = (float *) malloc(arrsize * sizeof(float));
? for (i = 0; i < arrsize; i++)
??? summe[i] = (double) rand() / (RAND_MAX / 2);
? printf("Calculating dead time...");
? gettime(&beg);
? for (i = 0; i < numreps; i++)
??? ;
? gettime(&end);
? dead = diff_time(&beg, &end);
? printf("%.2f seconds\n", (float) dead/100);
? printf("Timing inline summation...");
? gettime(&beg);
? for (i = 0; i < numreps; i++) {
??? double ret = 0;
??? int j;
??? for (j = 0; j < arrsize; j++)
????? ret += summe[j];
? }
? gettime(&end);
? slow = diff_time(&beg, &end);
? printf("%.2f seconds\n", (float) slow/100);
? printf("Timing sumarray()...");
? gettime(&beg);
? for (i = 0; i < numreps; i++) {
??? ret = sumarray(summe, arrsize);
? }
? gettime(&end);
? fast = diff_time(&beg, &end);
? printf("%.2f seconds\n", (float) fast/100);
? printf("sumarray() %d%% faster than inline code to do summation\n", percent_diff(dead, fast, slow));
? free(summe);
? return 0;
}
非常好我支持^.^
(4) 100%
不好我反對
(0) 0%
下載地址
rarvesa_vga下載
相關(guān)電子資料下載
- pic單片機匯編程序?qū)嵗?/a> 297
- 匯編指令是什么 計算機語言匯編指令簡介 130
- 匯編代碼是什么意思 121
- u-boot在匯編啟動階段的相關(guān)操作介紹 127
- 什么是C語言?單片機有什么特點?為什么要用C語言編程? 320
- 一文認識ARM匯編指令和體系架構(gòu) 412
- C程序的完整編譯過程 324
- KEIL軟件的詳細分析 213
- armasm編譯匯編代碼鏈接失敗的問題分析 184
- 看完這篇文章,匯編也不難 325