💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2024-07-09 at 03:30:54.
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Path: news1.icaen!news.uiowa.edu!NewsNG.Chicago.Qual.Net!nyd.news.ans.net!newsfeeds.ans.net!news.idt.net!newsfeed.cwix.com!152.163.199.19!portc03.blue.aol.com!audrey03.news.aol.com!not-for-mail From: babarstcyr@aol.com (BabarStCyr) Newsgroups: comp.sys.apple2.programmer Subject: Re : Re: A little optimization exercice... Lines: 118 NNTP-Posting-Host: ladder03.news.aol.com X-Admin: news@aol.com Date: 05 Dec 1998 18:44:50 GMT References: <3665BC9B.3E6E1035@americasm01.nt.com> Organization: AOL, http://www.aol.fr X-Newsreader: AOL Offline Reader Message-ID: <19981205134450.28844.00001092@ngol05.aol.com> Xref: news1.icaen comp.sys.apple2.programmer:10331 Hi World2 For Bryan: You are right. I keep your idea. For World2: If anybody find a problem in following listing please say it :-) In one week I shall upload executable to comp.sys.binary.apple2 so that anyone can send his result to baron@clifton.hobby.nl maintener of linux Bogomips_HowTo. My GS with 11.25Mhz/32k ---> 4.30 bogomips. Babar PS: I am thinking to an Apple2e version but I dunno about clock() function in AztecC DOS3.3 ;-) -------------------------------------------------------------------------- ------ /* * Standalone BogoMips program * * Based on code Linux kernel code in init/main.c and * include/linux/delay.h * * For more information on interpreting the results, see the BogoMIPS * Mini-HOWTO document. * * version: 1.3 * author: Jeff Tranter (Jeff_Tranter@Mitel.COM) */ #pragma lint -1 #pragma optimize -1 #define APPLE2GS_BOGOMIPS #include <stdio.h> #include <time.h> #ifdef CLASSIC_BOGOMIPS /* the original code from the Linux kernel */ static __inline__ void delay(int loops) { __asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax"); } #endif #ifdef APPLE2GS_BOGOMIPS /* Apple2GS version */ static void delay(long int loops) { asm { ldy loops+2 iny ldx loops beq la ici: dex bne ici la: dey bne ici } } #endif #ifdef QNX_BOGOMIPS /* version for QNX C compiler */ void delay(int loops); #pragma aux delay = \ "l1:" \ "dec eax" \ "jns l1" \ parm nomemory [eax] modify exact nomemory [eax]; #endif #ifdef PORTABLE_BOGOMIPS /* portable version */ static void delay(int loops) { long i; for (i = loops; i >= 0 ; i--) ; } #endif int main(void) { unsigned long loops_per_sec = 1; unsigned long ticks; printf("Calibrating delay loop.. "); fflush(stdout); while ((loops_per_sec <<= 1)) { ticks = clock(); delay(loops_per_sec); ticks = clock() - ticks; if (ticks >= CLOCKS_PER_SEC) { loops_per_sec = (loops_per_sec / ticks) * CLOCKS_PER_SEC; printf("ok - %lu.%02lu BogoMips\n", loops_per_sec/500000, (loops_per_sec/5000) % 100 ); return 0; } } printf("failed\n"); return -1; } -------------------------------------------------------------------------- ------ Babar de Saint Cyr (France) LCD Apple 2c, WorkStation Apple2e, LW2 NTX, 11.25 Mhz TWGS, etc... ;-)