How can I determine CPU usage?

By AxelStone

Prophet (3189)

AxelStone's picture

08-05-2017, 22:49

Good day everyone, is there any option in some emulator or any plugin to determine CPU usage when I run a program? I'm really interesting in order to optimize some codes.

Thanks.

Login or register to post comments

By sd_snatcher

Prophet (3642)

sd_snatcher's picture

08-05-2017, 22:55

Tip: take a look at this thread.

By AxelStone

Prophet (3189)

AxelStone's picture

09-05-2017, 23:00

Thanks but it seems some kind os ASM routines to inject in your code, maybe? I think about something more external, for example, emulator detecting % of NOP per cycle in order to determine how much CPU is being used for a determined program.

I'm not sure if exists anything like this.

By Sandy Brand

Champion (295)

Sandy Brand's picture

09-05-2017, 23:36

Hmm, not always so easy to detect unless the 'external' source knows what to look for.

For example, CPU could be spinning in a loop, doing some generic stuff.

By Grauw

Ascended (10699)

Grauw's picture

10-05-2017, 08:49

My script in the thread sd_snatcher pointed to is a TCL script for openMSX. It starts running when a value is output to I/O port 2CH and stops when a value is output to 2DH. This can be done from any language, Assembler, C, Basic, Pascal, etc. If you put those in the right place you can determine the total time it spends idling. You do need to have the ability to modify the source code of course, and know where the wait loop is.

By AxelStone

Prophet (3189)

AxelStone's picture

10-05-2017, 18:16

Sadly I don't have source code allways, I'm trying to test 3rd party drivers against self made drivers in order to determine wich works better.

Thanks anyway.