Zsnes uses 50 % of CPU for nothing

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

michael flatley wrote:This isn't a bug, it's a design issue. I'm not an asm programmer nor will I ever be. There's little need to program in assembly these days.
Related code is in winlink.cpp. There's something like a total of 15 lines of inline assembly in that file which I highly doubt you'll have to touch for this.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Astxist
Rookie
Posts: 32
Joined: Wed Jul 28, 2004 12:40 pm

Post by Astxist »

Just wanted to show this image from the latest wip feb 2 2005.

http://home.pacific.net.au/~renaissance ... _usage.png.

Zsnes running Killer Instinct: ~15% of the cpu.
Zsnes in the Gui: ~0-2% of the cpu.

Damn good imo.


Astxist
Phil
Rookie
Posts: 21
Joined: Thu Aug 26, 2004 3:24 am

Post by Phil »

Well, using february 5 WIP, I've got Zsnes using ~67% of CPU when no game is loaded. ~23% when playing a game.

For Astxist. It appears an other application is using your CPU which may alter you result. It's written 100% CPU usage on your pic.
Ichinisan
Veteran
Posts: 603
Joined: Wed Jul 28, 2004 8:54 am

Post by Ichinisan »

If you click the "CPU" column header, it will sort them by which is using the most. "System Idle Process" should be using >80%
Clements
Randomness
Posts: 1172
Joined: Wed Jul 28, 2004 4:01 pm
Location: UK
Contact:

Post by Clements »

Yeah, System Idle Process refers to the %age CPU that is not currently being used.
stale
Rookie
Posts: 29
Joined: Sat Aug 07, 2004 4:57 pm
Location: mankato mn
Contact:

Post by stale »

grinvader wrote:... You think that when you minimize a program to the taskbar it doesn't use any CPU to do its stuff ?

Nice little metaphor: You're in front of your best friend. You turn around. Do you think your friend stopped breathing just because you can't SEE him breathing ?

Ok, the nice is over now. HAND.
did you put any thought into that post, or were you just so itching to flame michael that badly? zsnes shouldn't be emulating anything when minimized. it just has to hold state. and it just sits there in the gui. tell us why that should use anything other than minimal cpu
Aerdan
Winter Knight
Posts: 467
Joined: Mon Aug 16, 2004 10:16 pm
Contact:

Post by Aerdan »

You assume that ZSNES can't minimise during a game.
stale
Rookie
Posts: 29
Joined: Sat Aug 07, 2004 4:57 pm
Location: mankato mn
Contact:

Post by stale »

why anyone would want it to be running while minimized is beyond me. I don't think that's what the original poster was talking about, besides
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

michael flatley wrote:I'm not an asm programmer nor will I ever be. There's little need to program in assembly these days.
There are still many reasons to write code in assembly these days. Especially if you have some critical code that must run as fast as possible. And even if you never write a shred of assembly in your life, not knowing even a little is just pure ignorance. Any programmer should be aware of what is going on inside the computer. But unfortunatly most places these days just teach programming like this:

Ok we are goint to teach you printf

printf("Hello World"); prints Hello World on the screen. roflmao@#$@#$%$ it works so we don't need to know anything else#$@

How do arguments get passed to my functions? it just magically happens#@$#@$ an so on. It is a very sad state with all these new people entering the trade and when you put them in front of a real debugger they have nfi.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

pagefault wrote: printf("Hello World"); prints Hello World on the screen. roflmao@#$@#$%$ it works so we don't need to know anything else#$@
You think that's bad? I see people doing stuff like this:

char blah[255];
gets(blah);
printf(blah);

The danger of using gets asside for the moment, these people don't know to do printf("%s", blah);, they think it's the same thing. Input a string with a % and watch the program get stack smashed to hell.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

stale wrote:why anyone would want it to be running while minimized is beyond me. I don't think that's what the original poster was talking about, besides
I did this on a daily basis to play ToP/SO music before getting the SPCs.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Sferics
Regular
Posts: 201
Joined: Mon Aug 09, 2004 3:48 am
Contact:

Post by Sferics »

Nightcrawler wrote:...like a 12 year old...
Should I feel offended?
David Dunham - "Efficiency is intelligent laziness"
michael flatley
Rookie
Posts: 42
Joined: Wed Aug 18, 2004 10:15 pm

Post by michael flatley »

I'm glad the issue is settled. I hadn't tested the latest WIP to see what my CPU usage was at.

pagefault, there may be a few opportunities for asm but it's a dangerous practice. ZSNES is living proof that asm is a bad idea all the way around. The gui should be the easiest freaking thing to modify and all I ever hear from the developers is "good feature but the gui is impossible to modify". Unless you are the lead programmer for the next big 3D engine you should be worrying about the readability and understandability of your code as opposed to a few cycles (I won't even go into the arguments on how C can be faster than asm...).

I do agree that teaching asm (and machine code as well) is a good practice that leads to more efficient object oriented code.
Astxist
Rookie
Posts: 32
Joined: Wed Jul 28, 2004 12:40 pm

Post by Astxist »

Follow up to my other post. I was running the UD Agent, it was using the cpu. Here's another two screens without the UD Agent running, for you non-believers :P.

http://home.pacific.net.au/~renaissance ... e_idle.png.
http://home.pacific.net.au/~renaissance ... unning.png.

Iirc pagefault fixed this, thanks pagefault.

Astxist
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

michael flatley wrote:pagefault, there may be a few opportunities for asm but it's a dangerous practice. ZSNES is living proof that asm is a bad idea all the way around. The gui should be the easiest freaking thing to modify and all I ever hear from the developers is "good feature but the gui is impossible to modify".
Is that pagefault's fault? No. You want to complain about that, talk to zsKnight and/or _Demo_.
[u][url=http://bash.org/?577451]#577451[/url][/u]
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

No offence NN, but you'd have more luck trying to find _Demo_ than zsKnight.
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
Tallgeese
Justice is Blind
Posts: 620
Joined: Wed Jul 28, 2004 3:33 pm
Location: Test
Contact:

Post by Tallgeese »

adventure_of_link wrote:No offence NN, but you'd have more luck trying to find _Demo_ than zsKnight.
He was being sarcastic on the talking to them bit.
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

Ahh. Then I either need a nice nap, or my sarcasm detection meter needs a new battery,
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
MaxSt
ZSNES Developer
ZSNES Developer
Posts: 113
Joined: Wed Jul 28, 2004 7:07 am
Location: USA
Contact:

Post by MaxSt »

michael flatley wrote:ZSNES is living proof that asm is a bad idea all the way around.
ZSNES is the only emulator I know with playable hq4x filter.
It's fast enough to be playble because it's written in optimized assembler.

So ZSNES for me is living proof that assember is a good thing.

MaxSt.
Post Reply