Module: Execution Time v1.0 [Linux + Windows]

Adding Modules to help with scripting/coding plugins.
User avatar
Archive-Poster
Posts: 1090
Gender:
United States of America

Module: Execution Time v1.0 [Linux + Windows]

Post by Archive-Poster »

Execution Time
1.0

Informations

♠ You will be able to view how much time a function take.

Header File

Code: Select all

/* Counts by now */
native Execution_Time_Stick( );

/* Returns time counted, float inside string */
/* Do not exceed 128 characters */
/* 16 characters is a good value to use */
native Execution_Time_Return( String[ ], Length );

/* Transforms float inside string in pure float */
stock Float: Execution_Time_Return_Float( String[ ] )
    return str_to_float( String );
Example of Plugin

Code: Select all

#include < amxmodx >
#include < execution_time >

new g_String[ 16 ];

public plugin_init( ) {
    Execution_Time_Stick( );

    for( new i = 0; i < 24000; i++ )
        server_print( "1 + 1 = 2" );

    Execution_Time_Return( g_String, charsmax( g_String ) );

    server_print( "Printing 24,000 lines to server's console took %f seconds!", Execution_Time_Return_Float( g_String ) );

    Execution_Time_Stick( );

    for( new i = 0; i < 12000; i++ )
        server_print( "1 + 1 = 2" );

    Execution_Time_Return( g_String, charsmax( g_String ) );

    server_print( "Printing 12,000 lines to server's console took %f seconds!", Execution_Time_Return_Float( g_String ) );
} 
Function to Remove Unused Zeros

Code: Select all

/*
  Input: "0.200000"
  Output: "0.2"
*/

Remove_Unused_Zeros( String[ ] ) {
  for( new Iterator = strlen( String ) - 1; Iterator >= 2; Iterator-- ) {
    if( String[ Iterator ] == '0' ) {
      if( String[ Iterator - 1 ] == '.' )
        break;

      else
        String[ Iterator ] = '^0';
    }
  }
} 
Attachments
Execution Time Source Code.zip
(271.86 KiB) Downloaded 3 times
execution_time_amxx_i386.so.zip
(5.63 KiB) Downloaded 6 times
execution_time_amxx.dll.zip
(33.94 KiB) Downloaded 5 times
execution_time.inc.zip
(516 Bytes) Downloaded 5 times

Who is online

Users browsing this forum: No registered users and 0 guests