Easy profiler

addons Easy profiler 0.01

Нет прав для скачивания
Установка
  1. Поместить easyprofiler_amxx.dll или easyprofiler_amxx.so (в зависимости от ОС сервера) из папки /bin в папку amxmodx/modules.
  2. Поместить easy_profiler.inc из /scripting/include в папку include вашего компилятора.
  3. Воспользоваться API модуля для тестирования плагинов.
API
Код:
/**
* Pushes current time in the profiler virtual stack
*
* @noreturn
*/
native ep_start();


/**
* Pops a time from the profiler virtual stack, calculates return value and
* prints log message accroding to fmt if it was set.
*
* @param count         Divisor for time (iterations count)
* @param fmt           C style format, where "%f" stands for time
*
* @return              Elapsed time for `count` operations +-correction value
*/
native Float:ep_end(count = 1, fmt[] = "");


/**
* Pauses execution
*
* @param time         Time in seconds
*
* @return             Return value of linux select(...)
*/
native ep_sleep(Float:time);


/**
* Sets global correction value
*
* @param time         Correction value
*
* @noreturn
*/
native ep_set_correction(Float:time);


/**
* Pops a time from the profiler virtual stack, sets correction, calculates return value,
* prints log message according to fmt if it was set and correction >0.0.
*
* @param count         Divisor for time (iterations count)
* @param fmt           C style format, where "%f" stands for time
*
* @return              Correction value
*/
native ep_end_and_set_correction(count = 1, fmt[] = "");


/**
* Dummy call that returns immediately
*
* @noreturn
*/
native ep_dummy_call();


/**
* Automatically calibrate easyprofiler.
*
* @param n         Number of iterations
*
* @noreturn
*/
stock ep_calibrate(n = 50000)
{
    ep_start();
    for(new i = 0; i < n; ++i)
    {
        ep_start();
        ep_end();
    }
    ep_end_and_set_correction(n, "Correction is set to %.17f");
}
Сверху Снизу