vendredi 31 mai 2013

LibraryTimer (I) [eng]

LibraryTimer v1.1 is a program available on aminet is really interesting for our goal. It gives the possility to know with accuracy the usage frequency of any kind of Amiga library.

A reminder for beginners: libraries for our Amiga are made of many functions that have a special use. For example, the function R_CacheFlush of exec.library allows to undo everything in the CPU code and data cache. For who is interested in this article: Warp3D drivers have functions too and LibraryTimer allows to know how many time programs using Warp3D (like Quake 2 for example) call a lot of available functions. The use for coders is to rework the most important functions: the ones that are often called. Of course, statistics change according to launched programs and possibly according to a game sequence. So for the time, we launch Quake 2 and its beginning.

Its usage is very easy. You just have to launch the game:

Then go back to the Workbench with Amiga-M then click on LibraryTimer program. Once loaded, you have to choose a library to examinate. For our example, it's WD3_AvengerLEMU.library and after click on "Patch":

Go back to the game, then play it for a short time: something like two minutes in order to have a statistic sample. Go back to the workbench then click on "Update". Here is the number of "calls" displayed for every function (Offset) :

We can already see that few functions are called for the short play of Quake 2. Function -$24 and -$40 have been used 571 time ($23B in hexadecimal) and 572 time ($23C). We can observe that "Time ticks" give the average time taken by the executed function: I don't know now if these results are serious and accurate.

Another function has been used many time. It's the -$6C with 6769 calls ($1A71) :

But there is something stronger for our example! -$19E called 206 387 times ($32633) !! It's incredible! -$1BC and -$1C2 around 108 390 times ($1A766) and 14 307 ($37E3) for the other :

It's perfectly clear: it's -$19E that need to be optimized as much as possible!! it's called by W3D_GetDriverTexFmtInfo from Warp3D.library :

So you have understood: LibraryTimer is useful for locating used function and what's most important the ones that are the most requested.
(translated by johnz)

Aucun commentaire:

Enregistrer un commentaire

Laissez vos commentaires ici :