Errors, bugs, questions - page 655

 
Urain:

Thanks for the link, but just a follow-up question: can this code be used to test graphics card performance?

No. First you have to add a couple of million objects per page. And then loop(10000){ ChartRedraw(); }

:)

 
MetaDriver:

Nah. First, you will have to add a couple of million objects per page. And then loop(10000){ ChartRedraw(); }

:)

A couple of million is too much, but 100k is good enough for a test.

#property script_show_inputs
input uint Count=1000;
input uint CountObj=100000;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
   long ChId=ChartID(); 
   for(int i=0;i<CountObj;i++)
     {
      ObjHLine(ChId,i,1.+(i/(double)CountObj));
     }
   uint st=GetTickCount();
   for(uint i=0; i<Count; i++)ChartRedraw();
   Alert("Count ChartRedraw()=",Count," time=",GetTickCount()-st," mk.c.");
   ObjectsDeleteAll(ChId,0,OBJ_HLINE);
  }
//+------------------------------------------------------------------+
void ObjHLine(ulong chart_id,string name,double price)
  {   
   ENUM_OBJECT  type=OBJ_HLINE; // тип объекта  
   int          nwin=0;                   // индекс окна   
//---
   if(ObjectFind(chart_id,name)<0)
      ObjectCreate(chart_id,name,type,nwin,0,0,0,0);
   ObjectSetInteger(chart_id,name,OBJPROP_COLOR,clrGreen);
   ObjectSetDouble(chart_id,name,OBJPROP_PRICE,price);
  }
//+------------------------------------------------------------------+

Is it ok? Is it possible to call it "objective test of video card suitability for MT5"?

Or maybe the objects should also change their values?

 
Urain:

A couple of million is too much, but 100k is good enough for a test.

Is it suitable? Is it possible to call it "objective video card test for mt5"?

What does it say? :) i have

2012.02.27 19:04:09 CardTest(Urain) (EURUSD,H1) Count ChartRedraw()=1000 at time=26224 ms

 
MetaDriver:

What's it say? Mine.

2012.02.27 19:04:09 CardTest(Urain) (EURUSD,H1) Count ChartRedraw()=1000 at time=26224 ms


Let's try redrawing part of the objects, and specifying the CPU and the video card. If the developers do not reject it, then we can create a branch and everyone will post their data. Here's the code with redrawing part of the objects.

#property script_show_inputs
input uint Count=1000;
input uint CountObj=100000;
input uint CountObjRedrawt=1000;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
   long ChId=ChartID();
   uint sto,eno,reso;

   for(int i=0;i<CountObj;i++)
     {
      ObjHLine(ChId,i,1.+(i/(double)CountObj));
     }
   sto=GetTickCount();
   for(int i=0;i<CountObjRedrawt;i++)
      ObjectSetDouble(ChId,rand()%CountObj,OBJPROP_PRICE,1.+((i+1)/(double)CountObj));
   eno=GetTickCount();
   reso=eno-sto;

    uint st=GetTickCount();
   for(uint i=0; i<Count; i++)
     {
      if(i%2==0)
        {
         for(int j=0;j<CountObjRedrawt;j++)
            ObjectSetDouble(ChId,rand()%CountObj,OBJPROP_PRICE,1.+((i+2)/(double)CountObj));
        }
      else
        {
         for(int j=0;j<CountObjRedrawt;j++)
            ObjectSetDouble(ChId,rand()%CountObj,OBJPROP_PRICE,1.+((i+1)/(double)CountObj));
        }
      ChartRedraw();
     }
   Alert("ChartRedraw() Count=",Count," CountObj=",CountObj," CountObjRedrawt=",CountObjRedrawt," time=",GetTickCount()-st-(reso*Count)," mk.c.");
   ObjectsDeleteAll(ChId,0,OBJ_HLINE);
  }
//+------------------------------------------------------------------+
void ObjHLine(ulong chart_id,string name,double price)
  {
   ENUM_OBJECT  type=OBJ_HLINE; // тип объекта  
   int          nwin=0;                   // индекс окна   
//---
   if(ObjectFind(chart_id,name)<0)
      ObjectCreate(chart_id,name,type,nwin,0,0,0,0);
   ObjectSetInteger(chart_id,name,OBJPROP_COLOR,clrGreen);
   ObjectSetDouble(chart_id,name,OBJPROP_PRICE,price);
  }
//+------------------------------------------------------------------+

here is rewritten more prints that was visible at what settings.

Oops, internal counters need to be changed to j.

 

Writes:

Test VideoCart (EURUSD,M15)     ChartRedraw() Count=1000 CountObj=100000 CountObjRedrawt=1000 time=24859 mk.c.
Проц P4 3 Гц, RAM 3 Гб
Видяха NVIDIA Corporation GeForce GT 430 with OpenCL 1.1 (2 units, 1400 MHz, 1023 Mb, version 295.73)
 
Urain:

Let's try redrawing part of the objects, and specifying the CPU and the video card. If the developers don't reject it, we can create a branch and all who wish will post their data. Here is the code with redrawing part of the objects.

This test more tests speed of asynchronous communication queue with objects (ObjectSetXXXX function), but not video system.
 
Renat:
This test more tests speed of asynchronous communication queue with objects (ObjectSetXXXX function), not video system.

I'm not claiming, but maybe you didn't notice that before the test started, the cyclic time of changing objects was measured, followed by subtracting a multiple of the time from the total.

   sto=GetTickCount();
   for(int i=0;i<CountObjRedrawt;i++)
      ObjectSetDouble(ChId,rand()%CountObj,OBJPROP_PRICE,1.+((i+1)/(double)CountObj));
   eno=GetTickCount();
   reso=eno-sto;
...
   " time=",GetTickCount()-st-(reso*Count)

Correct me if I'm wrong.

SZY Uniquely I do not discount if(i%2==0) but I do not think that this test will significantly change the figures, we need the relative figure on different videahas.

HH By the way, similar measurements are obtained without redrawing, even a little bit more, which probably says that when using ObjectSetXXXXX function often, its work is somehow accelerated, and time deduction is slightly overestimated.

 
Urain:

Writes:

It's like this now:

2012.02.27 19:37:44    gpu_Test (Urain) (EURUSD,M30)    ChartRedraw() Count=1000 CountObj=100000 CountObjRedrawt=1000 time=22792 mk.c.

CPU: AuthenticAMD AMD Phenom(tm) II X6 1100T Processor with OpenCL 1.1 (6 units, 3840 MHz, 16345 Mb, version 2.0)
GPU: Advanced Micro Devices, Inc. Cayman with OpenCL 1.1 (20 units, 750 MHz, 1024 Mb, version CAL 1.4.1664 (VM))


But this is on a blank screen. When it's like this (512 lines on the top display and the same on the bottom display):


then it's like this.

2012.02.27 19:47:53    gpu_Test (Urain) (EURUSD,M1)    ChartRedraw() Count=1000 CountObj=100000 CountObjRedrawt=1000 time=123022 mk.c.

And the indicator by itself does not load the GPU at this time (calculation at zero bar on CPU), it loads only the terminal rendering of all this mess.
 
Urain:

I'm not claiming, but maybe you didn't notice that before the test started, the cyclic time of changing objects was measured, followed by subtracting a multiple of the time from the total.

Yes, I didn't notice right away that there is a correction operation.

But still my correction is completely correct. The velocity of an asynchronous queue (which is really a queue) depends directly on the mode of operation of the queue.

First, you measured the speed of the queue per write with no external stimuli and no read operations from it. In fact it was instantaneous (reso=0 ms, check for yourself). But then you started using not only write but also read operations via ChartRedraw in your tests, which started blocking the queue for proofreading and overlapping all operations.

In fact, this is a test of 1,000,000 changes among 1,000 objects in an existing set of 100,000 objects. There is no way to call it a video test using ObjectXXXx functions.

 
Renat:

Yes, I didn't notice right away that there is a correction operation.

But still my correction is completely correct. The speed of an asynchronous queue (which is really a queue) depends directly on the mode of handling it.

First, you measured the speed of the queue per write with no external stimuli and no read operations from it. In fact it was instantaneous (reso=0 ms, check for yourself). But then you started using not only write but also read operations via ChartRedraw in your tests, which started blocking the queue for proofreading and overlapping all operations.

In fact, this is a test of 1,000,000 changes among 1,000 objects in an existing set of 100,000 objects. This cannot be called a video test using ObjectXXXx functions.

And if we first measure the full set of repaints without ChartRedraw and then with it, and make a subtraction, would it be correct?

By the way, the topic is very relevant, you could write a test, it's easier for you knowing internal structure of mql.

#property script_show_inputs
input uint Count=1000;
input uint CountObj=100000;
input uint CountObjRedrawt=1000;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
   long ChId=ChartID();
   uint sto,eno,reso;

   for(int i=0;i<CountObj;i++)
     {
      ObjHLine(ChId,i,1.+(i/(double)CountObj));
     }
   sto=GetTickCount();// замерим время вычета
   for(uint i=0; i<Count; i++)
     {
      if(i%2==0)
        {
         for(int j=0;j<CountObjRedrawt;j++)
            ObjectSetDouble(ChId,rand()%CountObj,OBJPROP_PRICE,1.2+((i+2)/(double)CountObj));
        }
      else
        {
         for(int j=0;j<CountObjRedrawt;j++)
            ObjectSetDouble(ChId,rand()%CountObj,OBJPROP_PRICE,1.2+((i+1)/(double)CountObj));
        }      
     }
   for(int i=0;i<CountObj;i++)// вернём всё в исходное состояние
     {
      ObjectSetDouble(ChId,i,OBJPROP_PRICE,1.+(i/(double)CountObj));
     }     
   eno=GetTickCount();
   reso=eno-sto;
   
   uint st=GetTickCount();
   for(uint i=0; i<Count; i++)
     {
      if(i%2==0)
        {
         for(int j=0;j<CountObjRedrawt;j++)
            ObjectSetDouble(ChId,rand()%CountObj,OBJPROP_PRICE,1.2+((i+2)/(double)CountObj));
        }
      else
        {
         for(int j=0;j<CountObjRedrawt;j++)
            ObjectSetDouble(ChId,rand()%CountObj,OBJPROP_PRICE,1.2+((i+1)/(double)CountObj));
        }
      ChartRedraw();
     }
   Alert("ChartRedraw() Count=",Count," CountObj=",CountObj," CountObjRedrawt=",CountObjRedrawt," time=",GetTickCount()-st-reso," mk.c.");
   ObjectsDeleteAll(ChId,0,OBJ_HLINE);
  }
//+------------------------------------------------------------------+
void ObjHLine(ulong chart_id,string name,double price)
  {
   ENUM_OBJECT  type=OBJ_HLINE; // тип объекта  
   int          nwin=0;                   // индекс окна   
//---
   if(ObjectFind(chart_id,name)<0)
      ObjectCreate(chart_id,name,type,nwin,0,0,0,0);
   ObjectSetInteger(chart_id,name,OBJPROP_COLOR,clrGreen);
   ObjectSetDouble(chart_id,name,OBJPROP_PRICE,price);
  }
//+------------------------------------------------------------------+