@d4f: do what ever you like, I won't call a lawyer or so... was just a stupid comment :-)
100% cpu load does not necessarily mean usleep returns without sleeping. in fact it means the linux kernel has seen the process not sleeping everytime it measured the cpu load. beware that linux does this only with the HZ set on kernel compilation. even if that is 1000 this is way too rare to really measure the cpu load. still, it proably indicates some kind of a problem if the server runs at 100% constantly, but it's hard to derive what kind of problem that is... usleep returning immediately is only one possible explanation.
btw: my lib doesn't use clock_nanosleep but nanosleep...
01-02-2010, 10:14 PM (This post was last modified: 01-02-2010, 10:20 PM by 3v1l.)
Crash Server when we change the map for de_inferno on css its very strange (test on 2 servers) :
Error: Material "maps/de_inferno/liquids/infernowater_568_2710_213" : proxy "AnimatedTexture" not found!
Error: Material "maps/de_inferno/liquids/infernowater_568_2710_213" : proxy "TextureScroll" not found!
Error: Material "maps/de_inferno/liquids/infernowater_568_2710_213" : proxy "WaterLOD" not found!
Error: Material "maps/de_inferno/liquids/infernowater_-1610_688_24" : proxy "AnimatedTexture" not found!
Error: Material "maps/de_inferno/liquids/infernowater_-1610_688_24" : proxy "TextureScroll" not found!
Error: Material "maps/de_inferno/liquids/infernowater_-1610_688_24" : proxy "WaterLOD" not found!
Error: Material "dev/dev_waterbeneath2" : proxy "AnimatedTexture" not found!
Error: Material "dev/dev_waterbeneath2" : proxy "TextureScroll" not found!
Error: Material "dev/dev_waterbeneath2" : proxy "WaterLOD" not found!
Error: Material "maps/de_inferno/maps/de_inferno/liquids/infernowater_-1610_688_24_depth_26" : proxy "AnimatedTexture" not found!
Error: Material "maps/de_inferno/maps/de_inferno/liquids/infernowater_-1610_688_24_depth_26" : proxy "TextureScroll" not found!
Error: Material "maps/de_inferno/maps/de_inferno/liquids/infernowater_-1610_688_24_depth_26" : proxy "WaterLOD" not found!
Error: Material "maps/de_inferno/maps/de_inferno/liquids/infernowater_568_2710_213_depth_22" : proxy "AnimatedTexture" not found!
Error: Material "maps/de_inferno/maps/de_inferno/liquids/infernowater_568_2710_213_depth_22" : proxy "TextureScroll" not found!
Error: Material "maps/de_inferno/maps/de_inferno/liquids/infernowater_568_2710_213_depth_22" : proxy "WaterLOD" not found!
For de_nuke too :
Error: Material "maps/de_nuke/de_nuke/nukwater_movingplane_640_-976_-734" : proxy "AnimatedTexture" not found!
Error: Material "maps/de_nuke/de_nuke/nukwater_movingplane_640_-976_-734" : proxy "AnimatedTexture" not found!
de_tuscan :
Error: Material "maps/de_tuscan/nature/water_canals03_64_5688_-312" : proxy "AnimatedTexture" not found!
Error: Material "maps/de_tuscan/nature/water_canals03_64_5688_-312" : proxy "TextureScroll" not found!
Error: Material "maps/de_tuscan/nature/water_canals03_64_5688_-312" : proxy "WaterLOD" not found!
Error: Material "nature/water_canals03_beneath" : proxy "AnimatedTexture" not found!
Error: Material "nature/water_canals03_beneath" : proxy "TextureScroll" not found!
Error: Material "nature/water_canals03_beneath" : proxy "WaterLOD" not found!
When i unload the lib the server change the map perfectly
And with the lib of BehaartesEtwas the map change perfectly too .
01-02-2010, 10:41 PM (This post was last modified: 01-02-2010, 11:39 PM by Rom1.)
I found the problem with 100% cpu load.
It happens for very big or negative sleep values. Your code must verify that tv_nsec is not bigger than 1000 millions or negative.
In my code a conversion error allowed negative values. On FPsstabilizer or HLbooster I think it's the same.
I had a look a FPSstabilizer and i don't understand something.
To check if you have to recalculate average you do:
Code:
if ( tick_count >= FPSS_RECALCULATE_EVERY ) { //tick2check
and after this loop you do:
Code:
tick_count = tick_count + usec;
But ... most of the time usec value is bigger than 1000 and FPSS_RECALCULATE_EVERY is 500.
So, it would calculate an average on every frame: just like adaptative usleep from Monk.
(12-31-2009, 07:31 AM)d4f Wrote: I've modified the hl-booster.c so that, in addition to the pre-existing functions it now provides:
Possibility to surpass 1000fps
Stable FPS for hlds & srcds
"Stable FPS" means that it actively and gradually corrects the usleep-timings to match the desired FPS-values. No more trial & error!
Furthermore it makes sure that hlds-servers don't go above 1000fps and thus the game time doesn't speed up.
FPS-values above 1000 do not make the game run better, it even can make it actually run worse. So please only use this for educational or testing purpose. I'm sick and tired of companys selling their "10k FPS" Servers as being 10x better than 1000fps.
Usage:
Replace DiSTANT's hl-booster.c with the attached one and then run "make clean && make && make install" to update the Lib it with the current one.
Changes to the source code should _not_ be necessary.
Please note that fps_max should _always_ be set to "0" when using this lib, as the actual fps-limiation is now done directly by the usleep() function. (Even if FPS is to be set below 1000)
Please report any issues or success
When using it in a commercial environment, please don't forget the extended usage conditions. Thx
Credits go to: (in no particular Order) Monk, BehaartesEtwas, DiSTANT
[31/12/09]
~Bug fixed which crashes the game when no FPS-value is defined.
[01/01/10]
~math.h now included in the headers.
~Informations about fps included in the comments (please read!)
Very nice! This is what I have been trying to get the community to do for quite some time now. These changes, and others, can be found in libraries that i rent out to commercial interests.
A next improvement you should look into is adding an rdtsc timekeeper. This should remove about ~90% of the system calls and will lower cpu usage by about 10% (or so I have seen with trial code on my servers).
I am willing to help out with this (as I have already written the code), however my code is a little buggy (random crashing). Anyways, head into #sourcekernel and lets work together.
@Ronny & Rom1:
You both are correct ^^
I've somehow managed to mix up milliseconds (10e-3) with microseconds (10e-6), so it creates an average on 1 frame
However I believe that my notion of "stabilizing" is different than yours Rommy
By stabilizing I mean that the actual fps do not derive from the theoretical value over time, not that it corrects drops.
I'm working (for the fun) on a version that will generate a clean graph, however the drop itself (which is usually only 1-2 fps long) cannot be corrected.
Usually, as Terrorkarotte already pointed out, drops are due to a mapchange or new round - thus not affecting ingame behaviour.
I've uploaded Version 1.0.1 which will repair the bugs discovered so far.
It's default values are now a lot more agressive as the cpu-load difference is very low.
@Distant:
See you in IRC
Q: What would an omnipotent computer to?
A: Get rid of humanity!
(01-03-2010, 10:05 AM)d4f Wrote: Usually, as Terrorkarotte already pointed out, drops are due to a mapchange or new round - thus not affecting ingame behaviour.
I've uploaded Version 1.0.1 which will repair the bugs discovered so far.
It's default values are now a lot more agressive as the cpu-load difference is very low.
If you want a clean graph without drops just set the timelimit longer than your measurement
@ronny: for actually stabelizing the fps all those libs follow the wrong approach... as everyone knows the actual height of the fps is not that important, so these libs are pretty useless :-) that's what several "warnings" say in different locations... this all is for fun and maybe for getting srcds knowing better, but not for making it better (not yet at least).
I have the 100% iussue still with the new version running srcds. Running it with FPS=500 the fps seams not to be affected by the lib anymore.
Any clue why?
(01-04-2010, 07:42 PM)Terrorkarotte Wrote: I have the 100% iussue still with the new version running srcds. Running it with FPS=500 the fps seams not to be affected by the lib anymore.
Any clue why?