GetMicrosecondCount

GetMicrosecondCount() 기능은 MQL5-프로그램 시작 후 경과된 마이크로초 수를 반환.

ulong  GetMicrosecondCount();

값 반환

ulong 유형 값.

예를 들어:

//+------------------------------------------------------------------+
//| 테스트 기능                                                       |
//+------------------------------------------------------------------+
void Test()
  {
   int    res_int=0;
   double res_double=0;
//---  
   for(int i=0;i<10000;i++)
     {
      res_int+=i*i;
      res_int++;
      res_double+=i*i;
      res_double++;
     }
  }
//+------------------------------------------------------------------+
//| 스크립트 프로그램 시작 함수                                         |
//+------------------------------------------------------------------+
void OnStart()
  {
   uint   ui=0,ui_max=0,ui_min=INT_MAX;
   ulong  ul=0,ul_max=0,ul_min=INT_MAX;
//--- 측정 횟수
   for(int count=0;count<1000;count++)
     {
      uint  ui_res=0;
      ulong ul_res=0;
      //--- 
      for(int n=0;n<2;n++)
        {
         //--- 측정 유형 선택
         if(n==0) ui=GetTickCount();
         else     ul=GetMicrosecondCount();
         //--- 코드 실행 
         Test();
         //--- 측정 결과 추가(종류에 따라 다름)
         if(n==0) ui_res+=GetTickCount()-ui;
         else     ul_res+=GetMicrosecondCount()-ul;         
        }
      //--- 최소 및 최대 두 측정 시간을 계산
      if(ui_min>ui_res) ui_min=ui_res;
      if(ui_max<ui_res) ui_max=ui_res;
      if(ul_min>ul_res) ul_min=ul_res;
      if(ul_max<ul_res) ul_max=ul_res;
     }
//---
   Print("GetTickCount error(msec): ",ui_max-ui_min);
   Print("GetMicrosecondCount error(msec): ",DoubleToString((ul_max-ul_min)/1000.0,2));
  }

추가 참조

Date and Time, GetTickCount, GetTickCount64