About the MT5 code profiler - page 6

 
fxsaber #:

I just don't understand why the 45% strings and the rest are not taken into account?

They include those native functions, the load of which I wrote about.

RefreshHistory consists of HistorySelect and HistoryOrderGet, GetHistoryPositionData - from them + HistoryDealGet.

It also helps to run through the code with your eyes and analyze the most red lines. However, they are not always highlighted, if the code is slightly more complex than a sheet.

 
fxsaber #:

29.41% (it's unclear why) is due to a closing bracket after return. Difficult to interpret.

Removing local function variables, local objects, etc.

This is done after any return from function.

 
Andrey Khatimlianskii #:

Removal of local function variables, local objects, etc.

This is done after any return from the function.

There are only three ulong variables.

 
fxsaber #:

Added a 20x repetition on the big story.

29.41% (it's unclear why) is due to a closing parenthesis after return. Difficult to interpret.

What's in the report for this function ?

Please show me

 
Ilyas #:

What is in the report for this function ?

Please show me

MQL Profiler Report - \MQL5\Experts\Test19.mq5
Function Line Total CPU Percentage Self CPU Percentage
MT4ORDERS::GetHistoryPositionData 1093 701
85.38%
260
31.67%
} 1360 157
21.96%
157
60.38%
static void GetHistoryPositionData( const ulong Ticket ) 1093 46
6.43%
46
17.69%
const string StrComment = ::HistoryDealGetString(OpenTicket, DEAL_COMMENT); 1178 23
3.22%
11
4.23%
MT4ORDERS::Order.Comment = ::HistoryDealGetString(Ticket, DEAL_COMMENT); 1107 20
2.80%
10
3.85%


I'm not sure this information is needed. Unfortunately, I don't understand the numbers very well yet. I would like to understand it.


SZY There are two lines in the table above with the same Line=1093. Maybe what playback data to provide in the PM?

 
fxsaber #:

There are only three ulong variables.

And all that are called from this function.

The execution time of function A contains the execution time of all functions B, which are called from A. Except when B is called from somewhere else (then only part of B's time will go to A).

 
Andrey Khatimlianskii #:

And everything called from that function.

The execution time of function A contains the execution time of all functions B, which are called from A. Except when B is called from somewhere else (then only part of B's time will go into A).

I meant the closing bracket.

 
fxsaber #:

I meant the closing parenthesis.

That's what I meant.)

Maybe I'm misunderstanding something myself.

 

Tester log (without Visualisation) after the profiler is running.

2021.11.08 03:21:54.358 Core 1  EURUSD,M1: 6820008 ticks, 258262 bars generated. Environment synchronized in 0:00:00.018. Test passed in 0:00:22.853 (including ticks preprocessing 0:00:01.219).
2021.11.08 03:21:54.358 Core 1  EURUSD,M1: total time from login to stop testing 0:00:22.871 (including 0:00:00.018 for history data synchronization)
2021.11.08 03:21:54.358 Core 1  disconnected
2021.11.08 03:21:54.358 Core 1  1578 Mb memory used including 24 Mb of history data, 192 Mb of tick data


Immediately afterwards, the Start button in the Tester is pressed by hand.

2021.11.08 03:23:00.166 Core 1  EURUSD,M1: 6820008 ticks, 258262 bars generated. Environment synchronized in 0:00:00.029. Test passed in 0:00:07.548 (including ticks preprocessing 0:00:01.203).
2021.11.08 03:23:00.166 Core 1  EURUSD,M1: total time from login to stop testing 0:00:07.577 (including 0:00:00.029 for history data synchronization)
2021.11.08 03:23:00.166 Core 1  444 Mb memory used including 24 Mb of history data, 192 Mb of tick data


  1. Why is the run time three times longer during profiling?
  2. Why is memory consumption three times higher during profiling?
 

The profiler shows function calls that didn't actually happen. I've even come across something like this:

Some kind of ArrayCopy, which isn't in the mqh-file source! I even drew a red line in the declaration of a static array.

I still can't use the profiler, unfortunately.