Topic: widelands and CPU usage
king_of_nowhere![]() Topic Opener |
Posted at:
2015-10-04, 20:20 UTC+2.0
Good idea. i tried it, and during the loading widelands was using 30-35% of my CPU and virtually nothing else. It also said the program wasn't answering during the loading - in fact, it is impossible to exit from load screen with alt-tab, but if you are already out of it due to not being on fullscreen, then you can use the pc just fine. CPU consumption also wasn't limited by the capacity of my pc. widelands was the only program that was using CPU at the time, so if the slowness was just a matter of making calculations, it could have used 100% of the CPU and loaded the game in 40 seconds. Then hard disk usage spike to close to 100% for a few seconds before it loaded the game - I suppose the game was loading the various data about maps and buildings from memory. But it didn't do it in the previous two minutes. It's like it did nothing for two minutes, then it suddenly loaded everything in a few seconds. MAybe there is some code that accidentally causes the game to run a lenghty series of operations the longer a game has lasted? Is there a way to modify a savegame file to cheat the computer into thinking the game has been shorter than it actually was? It would include deleting some statistics, but in theory it should not be complex, if one knows where to look. Then I could confirm that the game takes more CPU when reduced to icon. It run at 10-15% when it was opened as a window, but as soon as I reduced it, it spiked to 35%. And dropped again when I reopened it. I tried a few times just to make sure it wasn't random occurrence. No idea what may be causing that. I could not check what happened when I exited the game: cliicking on "exit game" caused the game to go in fullscreen again. And I could not alt-tab. But I suppose it would happen something similar to what happens in the loading.
Alas, that's way above my mediocre skill as computer (l)user. Gathering the data I did so far is pretty much the extent of my capabilities.
Edited:
2015-10-04, 20:20 UTC+2.0
![]() ![]() |
Tibor |
Posted at:
2015-10-04, 20:32 UTC+2.0
You should give it a try. The output looks like:
![]() ![]() |
king_of_nowhere![]() Topic Opener |
Posted at:
2015-10-04, 21:07 UTC+2.0
as i said, i am unable to produce that output. I have no flippin idea of what to do to get that. but i could send the saved game to someone who can try it. ![]() ![]() |
Tibor |
Posted at:
2015-10-04, 22:29 UTC+2.0
No big deal, open a terminal or whatever it is called on your os, here is a screenshot:
![]() ![]() |
wl-zocker |
Posted at:
2015-10-05, 09:20 UTC+2.0
See this page, point number 4. It tells you how to create a stdout.txt, where you find the loading times. EDIT: It is now point 6, Reporting a crash.
Edited:
2015-10-05, 20:00 UTC+2.0
"Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg ![]() ![]() |
king_of_nowhere![]() Topic Opener |
Posted at:
2015-10-05, 19:51 UTC+2.0
no, that's stilll way above what i can do with a pc. I can open a bug report, if you want ![]() ![]() |
Tibor |
Posted at:
2015-10-05, 21:57 UTC+2.0
It would do no harm if you open a bugreport. But it would look much nicer if you can mention there that 'the step XYZ takes suspiciously long to read/load'... ![]() ![]() |
SirVer |
Posted at:
2015-10-06, 09:27 UTC+2.0
I can throw in a theory here, but having a long save game attached to a bug report could make it easier to verify. Widelands uses pointers to link data structures together. A pointer is a memory address where another instance of an object is defined in memory. For example, buildings keep track of their inhabitants by pointers to the workers, Ships information about their wares and routes and so on. Problem is that memory locations change with each load. So Widelands splits loading into three steps: load what objects are available, load their individual data that is not pointers (for example the number of wares currently in a building, current HP of a soldier), and last: recreate the pointer links for each object. Each object has links to a couple of other objects, so the number of pointers raises quite dramatically and recreating them will take a non-linear amount of more time. I think that is were we are spending our time mostly during loading. I might be wrong of course. A better approach would have been to use an arena allocator for the game objects and keep them all around the same size to not waste too much memory. With that, loading would just recreate the arena and dump the memory from the file into the arena (minus some backwards compaibility cruft). Unfortunately, changing the design of Widelands to something like that is really out of the picture - way too much work. Loading could still be sped up by recreating the links in parallel (on many CPUs), but so far Widelands is single threaded, so that would be a bit of work too. ![]() ![]() |
king_of_nowhere![]() Topic Opener |
Posted at:
2015-10-08, 04:32 UTC+2.0
ok, bug report posted ![]() ![]() |
kaputtnik![]() |
Posted at:
2015-10-08, 08:34 UTC+2.0
Edited:
2015-10-08, 08:34 UTC+2.0
![]() ![]() |