![]() |
|
|
#1161 | |
|
Membre
Date d'inscription: juin 2006
Messages: 300
|
Citation:
Ps: c'est vicieux des edit de messages, failli passer à coté de ton message
__________________
Serveurs DoD:S / DoD |
|
|
|
|
|
|
#1162 | |
|
Membre
Date d'inscription: décembre 2008
Messages: 103
|
Re : Kernel 2.6.23 communauté OVH
Citation:
|
|
|
|
|
|
|
#1163 |
|
Membre
Date d'inscription: septembre 2007
Messages: 91
|
Re : Kernel 2.6.23 communauté OVH
Merci Cent,
voici ma page steam http://steamcommunity.com/id/chokapik A+ et bonne année tout le monde |
|
|
|
|
|
#1164 |
|
Membre
Date d'inscription: mars 2004
Messages: 73
|
Re : Kernel 2.6.23 communauté OVH
http://wiki.fragaholics.de/index.php/BEpingboost.c
Une autre lib ... Mais ces libs restent à utiliser pour des tests, en production, c'est déconseillé. Edit encore une autre ... Code:
/* ORIGINAL DISCLAIMER
*-
* Copyright (c) 2009 Seth Schultz "DiSTANT" <distant@padgaming.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*
THE FOLLOWING LINES WERE ADDED WHEN MODIFYING:
Any company or individual using this in a commercial environment must provide on the product website clearly visible
and easily accessible a link to the following websites:
~ http://1000fps-myth.de
~ http://forums.srcds.com/viewtopic/12685/3
Mod-Author:
Daniel Ruppert <srcds@kaffi.lu>
Preliminary Development:
BehaartesEtwas [ http://wiki.fragaholics.de/index.php/BEpingboost.c ]
DiSTANT [ http://forums.srcds.com/viewtopic/12685 ]
Monk [ http://people.summit-servers.com/monk/ ]
Release Date:
30/12/2009
Enjoy
[SOME NOTES ABOUT FPS]
As BehaartesEtwas already pointed out several times, the ping-difference between 100fps and 500fps is noticable,
however everything above is only a pipe dream. The lib might help to keep a certain fps value, but raising the fps _definitively_
does not give you more headshots. If you suck at 100 fps you will still suck at 100000000000fps.
I'm sick and tired of gamehosting companys selling a 10'000fps server as being 10x better than 1'000fps.
The only thing 10'000fps is better at -and they darn well know it- is making money. So _please_ be honest to your customers and
provide quality, not illusion! The fps only change your ping, what _really_ matters is the tickrate. And that one is fixed at 100 top for srcds.
*/
//
//
//START EDITING HERE IF NECESSARY (Default-Values should be OK!)
//Default to this FPS if ENV-value "FPSS_FPS" can't be found. (Default: 1000)
const int FPSS_DEFAULT_FPS = 1000;
//Calculate Average every X frames: (Default: 500)
const int FPSS_RECALCULATE_EVERY = 500;
//How many Frames should be ignored at the beginning? (Default: 5000)
const int FPSS_START_AFTER = 5000;
//DO NOT EDIT BELOW (unless you know _exactly_ what you do!)
//
//
//Software Release
#define FPSS_VERSION "1.0.0b"
#include <dlfcn.h>
#include <sched.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/timeb.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
//Support for HLDS pingboost 2 / 3 [Credits go to DiSTANT]
int select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) {
if(timeout->tv_usec == 1000) return usleep(timeout->tv_usec);
else {
struct timespec ts;
ts.tv_sec = timeout->tv_sec;
ts.tv_nsec = timeout->tv_usec * 1000;
return pselect(nfds, readfds, writefds, errorfds, &ts, NULL);
}
}
//High-Res gettimeofday [Credits go to DiSTANT]
int gettimeofday(struct timeval *tp, struct timezone *tzp) {
struct timespec ts;
//High resolution get time with clock_gettime and failover ftime estimation
if(clock_gettime(CLOCK_REALTIME, &ts) == 0) {
tp->tv_sec = ts.tv_sec;
tp->tv_usec = ts.tv_nsec / 1000;
}
else {
struct timeb tm;
ftime(&tm);
tp->tv_sec = tm.time;
tp->tv_usec = tm.millitm * 1000;
}
return 0;
}
static int tick_init = 0;
static int tick_init_cnt = 0;
static double tick_lasttime = 1;
static int tick_count = 0;
static double tick_changer = -1;
static double diff_wanted = 1000;
int usleep (useconds_t usec) {
//Sleep first Frames (engine bootup doesn't like us messing with FPS)
if ( !tick_init ) {
struct timespec tim;
clock_gettime(CLOCK_REALTIME, &tim);
if(tick_init_cnt < FPSS_START_AFTER) {
tick_init_cnt++;
struct timespec ts,rem;
ts.tv_sec = 0;
ts.tv_nsec = usec * 1000;
while(clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem) != 0) {
if(rem.tv_nsec < 6000) return 0;
else ts = rem;
}
return 0;
}
tick_init = 1;
printf("\nFPS control initialized!\n");
tick_lasttime = (tim.tv_sec*1000000000) + tim.tv_nsec;
}
struct timespec ts, rem;
double tick_changeby = 0;
//Recalculate average
if ( tick_count >= FPSS_RECALCULATE_EVERY ) { //tick2check
struct timespec tim;
clock_gettime(CLOCK_REALTIME, &tim);
double tick_curr = (tim.tv_sec*1000000000) + tim.tv_nsec;
double tick_diff = (double) (tick_curr - tick_lasttime) / tick_count; //How much time has elapsed since last calculation
double diff2now = fabs(floor(tick_diff-diff_wanted)); //Time per frame
if(diff2now >= 100.0) { tick_changeby = 100.0; } //Modify timer by x nsec
else if(diff2now >= 10.0) {tick_changeby = 10.0; }
else tick_changeby = 1.0;
if(tick_diff > diff_wanted) tick_changer = tick_changer - tick_changeby;
else tick_changer = tick_changer + tick_changeby;
tick_lasttime = tick_curr;
tick_count = 0;
}
tick_count = tick_count + usec;
ts.tv_sec = 0;
ts.tv_nsec = (int)(usec * 1000 + tick_changer);
while(clock_nanosleep(CLOCK_REALTIME, 0, &ts, &rem) != 0) { //High resolution sleep with clock_nanosleep [THANKS TO DiSTANT]
if(rem.tv_nsec < 6000) return 0; //Return if remaining time is below 6us
else ts = rem;
}
return 0;
}
void __attribute__((constructor)) construct()
{
printf("\n-------------------------------------------------");
printf("\n---> S33k3r proudly presents <---");
printf("\nFPS-Stabilizer Library (Version: %s)",FPSS_VERSION);
printf("\nContact: Daniel Ruppert <srcds@kaffi.lu>");
printf("\n\nCode-Lines taken from DiSTANT's HL-Booster.c");
printf("\nhttp://www.padgaming.com");
printf("\nirc.gamesurge.net #SourceKernel");
printf("\nVist for Details: http://forums.srcds.com/viewtopic/1268\n");
//Use env fps (Thanks to BehaartesEtwas for the Idea)
char *envvar;
envvar = getenv("FPS");
if(envvar) {
int nfps;
sscanf(envvar,"%d",&nfps);
diff_wanted = floor(1000000/nfps);
printf("\nFPS Value: %i",nfps);
}
else {
diff_wanted = floor(1000000/FPSS_DEFAULT_FPS);
printf("\nNO FPS-Value DETECTED (default: %i)",FPSS_DEFAULT_FPS);
}
//Credit for the following go to DiSTANT, taken from Hl-Booster.c
//Set realtime priority if user is root
if (geteuid() == 0) {
struct sched_param sp;
memset(&sp, 0, sizeof(sp));
sp.sched_priority = sched_get_priority_max(SCHED_FIFO);
sched_setscheduler(0, SCHED_FIFO, &sp);
//lock into memory to avoid paging
mlockall(MCL_CURRENT | MCL_FUTURE);
printf("\nPriority: REALTIME");
printf("\nMemory: LOCKED");
}
else {
printf("\nPriority: REGULAR");
printf("\nMemory: UNLOCKED");
}
printf("\n-------------------------------------------------\n\n");
}
Dernière modification par trakiss 01/01/2010 à 16h54 |
|
|
|
|
|
#1165 |
|
Membre
Date d'inscription: septembre 2007
Messages: 91
|
Re : Kernel 2.6.23 communauté OVH
J'ai découvert que l'idler causait des grosses chutes de fps comme on peut le voir sur le graphique
http://www.fpsmeter.org/p,view;38697.html Voici un graphique sans l'idler http://www.fpsmeter.org/p,view;38718.html Là je ne comprends plus rien C'est bon j'ai trouvé quand j'ajoute des utilisateurs - dans le script realtime - comme dans le tuto de madrippeur , l'idler fait tout foirer Donc voila ce que ca donne maintenant http://www.fpsmeter.org/p,view;38772.html Dernière modification par chokapik 02/01/2010 à 02h27 |
|
|
|
|
|
#1166 | |
|
Membre
Date d'inscription: décembre 2008
Messages: 103
|
Re : Kernel 2.6.23 communauté OVH
Citation:
http://www.fpsmeter.org/p,view;38815.html malgrès quelque chut celà reste pas mal stable, j'ai remarqué que le tick est plus stable à vide et il y a peut etre une meilleur stabilité c'est peu etre une impression. pour rajouter mon kernel : 2.6.32.2 Low Latency 2000hz 32bits pour ces tests. Dernière modification par CenT 02/01/2010 à 12h01 |
|
|
|
|
|
|
#1167 |
|
Membre
Date d'inscription: juin 2006
Messages: 300
|
Re : Kernel 2.6.23 communauté OVH
J'ai regardé le code de cette lib et je comprend pas un petit truc.
Nous sommes censé faire une moyenne du temps écoulé entre X frames. Code:
//Calculate Average every X frames: (Default: 500) const int FPSS_RECALCULATE_EVERY = 500; En effet, on compare tick_count à FPSS_RECALCULATE_EVERY. Hors en fin de boucle on incrémente tick_count de la valeur du delais (généralement 1000). Donc à tous les coups on est au dessus des 500 et on refait une moyenne ... Sinon cela ne stabilise pas vraiment. Oui on modifie la durée du usleep pour qu'il fasse en sorte d'obtenir un vrai 1000 fps (ou plus). Cela fonctionne plutôt bien. Oui cela utilise un clock_nanosleep à la place d'un usleep classique et donc on a plus de garanties sur le fait qu'on récupère la main au bon moment. Toutes les libs font ça. Sauf que cela ne garantie pas que un des usleeps ne va pas durer un peu plus longtemps et que nous allons récupérer la main immédiatement. On peut donc toujours avoir des baisses. On le voit bien sur les graph de Cent. En plus cela utilise toujours le clock_realtime... il faut utilise monotonic ! Au delà de ça, en 32bits vous avez un gain important en utilisant le gettimeofday modifié plutôt que l'original. En 64bits on ne sent pas de différence.
__________________
Serveurs DoD:S / DoD |
|
|
|
|
|
#1168 |
|
Membre
Date d'inscription: juin 2006
Messages: 300
|
Re : Kernel 2.6.23 communauté OVH
Pour info l'auteur vient de corriger son code en suivant mes remarques:
http://forums.srcds.com/viewpost/82267#pid82267
__________________
Serveurs DoD:S / DoD |
|
|
|
|
|
#1169 |
|
Membre
Date d'inscription: juin 2006
Messages: 300
|
Voici quelques benchs réalisés avec l'aide de Cent et Chokapic, merci à eux.
A chaque fois on mesure le temps pris pour exécuter 1000 fois une fonction. Le temps le plus court est donc le meilleur. Le test est lancé en SCHED_FIFO avec priorité haute. Résultats d'un EGBestOf / Xeon Quad 2.83Ghz / Kernel 32bits 2.6.32.2 Low Latency 2000 Hz (Cent): Code:
CPUHz: 2817080693.000000 ############ Clocks Tests ################ nsec per call (clock_gettime): 266.069411 nsec per call (clock_gettime + conversion to ns): 272.176087 nsec per call (rdtsc): 10.074969 nsec per call (rdtsc + conversion to ns): 35.565186 ############ Gettimeofday Tests ################ nsec per call (gettimeofday Kernel): 168.773298 nsec per call (gettimeofday RDTSC): 49.824629 nsec per call (gettimeofday MONOTONIC): 266.681747 Résultats d'un SP SSD/ CoreI5 750 / Kernel 64bits 2.6.31.4 Low Latency 1000 Hz (Daryl): Code:
CPUHz: 2667004252.000000 ############ Clocks Tests ################ nsec per call (clock_gettime): 310.952635 nsec per call (clock_gettime + conversion to ns): 295.683068 nsec per call (rdtsc): 9.289824 nsec per call (rdtsc + conversion to ns): 37.589741 ############ Gettimeofday Tests ################ nsec per call (gettimeofday Kernel): 293.049402 nsec per call (gettimeofday RDTSC): 55.040032 nsec per call (gettimeofday MONOTONIC): 297.230872 Résultats d'un Kimsufi 8XL / CoreI7 920 /Kernel 32bits 2.6.32.2 Low Latency 1000 Hz (Cent): Code:
CPUHz: 2660077272.000000 ############ Clocks Tests ################ nsec per call (clock_gettime): 247.209360 nsec per call (clock_gettime + conversion to ns): 250.392726 nsec per call (rdtsc): 9.395216 nsec per call (rdtsc + conversion to ns): 37.741761 ############ Gettimeofday Tests ################ nsec per call (gettimeofday Kernel): 128.466945 nsec per call (gettimeofday RDTSC): 54.249552 nsec per call (gettimeofday MONOTONIC): 246.806364 Code:
CPUHz: 2666848765.000000 ############ Clocks Tests ################ nsec per call (clock_gettime): 48.902286 nsec per call (clock_gettime + conversion to ns): 52.697401 nsec per call (rdtsc): 11.640330 nsec per call (rdtsc + conversion to ns): 25.892732 ############ Gettimeofday Tests ################ nsec per call (gettimeofday Kernel): 51.203128 nsec per call (gettimeofday RDTSC): 56.147541 nsec per call (gettimeofday MONOTONIC): 62.574602 Pour le gettime on voit une nette domination du rdtsc, peu importe le kernel. En 32 bits la différence est énorme. En 64 bits elle est plus mince. On voit clairement que le remplacement de la fonction gettimeofday tel que fait les libs publiques actuelles est inutile et même néfaste. Tout au plus une version rdtsc (aucune lib publique ne le fait actuellement) fait gagner du temps sur un kernel 32 bits. En 64 bits rien n'est plus rapide que l'originale. Note finale: le patch RT semble particulièrement efficace à en voir les résultats de la dernière machine (identique à l'avant dernière).
__________________
Serveurs DoD:S / DoD |
|
|
|
|
|
#1170 |
|
Membre
Date d'inscription: juillet 2009
Messages: 82
|
Re : Kernel 2.6.23 communauté OVH
bonjour a tous
voici un graph avec la meme lib debian 5 32bits kernel Cent RT9 1000hz tick 200 Zb MAni MEta TV mais vide http://fpsmeter.org/p,view;39539.html le kernel ce comporte bien sauf au lancement et log ou il y a une grosse latence il execute le premier mani en 1,320 sec au lieu de 0,040 pour un daryl RT 31 Dernière modification par firfanatic07 05/01/2010 à 12h19 Motif: maj |
|
|
|
![]() |
| Tags |
| kernel, srcds |
| Outils de la discussion | |
|
|