Skip to content

alirezaed/MQL4-Benchmark

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MQL4-Benchmark

Module for measuring execution speed.

Install

  1. Download Benchmark.mqh
  2. Save the file to /MQL4/Include/mql4_modules/Benchmark/Benchmark.mqh

Usage

  1. Include Benchmark.mqh.
  2. Execute the Start method before the processing you want to measure.
  3. Execute the End method after the processing you want to measure.
  4. Elapsed time is output to the Experts tab.
#include <Benchmark.mqh>

int OnInit()
{
   // Start measurement.
   Benchmark::Start("Sample");
   
   for(int i = 0; i < 1000000; i++) {
      // Some processing.
   }
   
   // End measurement.
   Benchmark::End();
   
   return(INIT_SUCCEEDED);
}

Instead of running the Start and End methods, you can also use BenchmarkRun.

int sum(int a, int b, int c)
{
   return(a + b + c);
}

int OnInit()
{
   // Output the time taken to execute the function sum one million times.
   BenchmarkRun(sum(100, 200, 300), 1000000); 
   
   return(INIT_SUCCEEDED);
}

About

Module for measuring execution speed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • MQL5 71.2%
  • MQL4 28.8%