Announcement

Collapse
No announcement yet.

high cpu usage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • high cpu usage

    Hi Jason,

    I have a problem that I can't seem to figure out.... 100% cpu usage on an AMD-64 3200+, 512M Ram, Win CP Sp2. Video Card 1 is Radeon 800XL, card 2 is Colorgraphic PCI LT2.. Usual physical memory available >100000, after loading esignal.

    I have 3 efs scripts that are modifications of the custom ones eg Stochastics. In my version of the script, I use graphic changes such as back ground, line colors/widths, etc.. , in both the price bar area and indicator area. I say this because when I go use the original scripts, my usage drops to 2%, but when I use those with the set.... graphic stuff, it goes to over 70%. And when I have multiple charts up, the usage is pegged at 100%.

    Now what is interesting, is that if I switch to another desktop, while leaving esignal still running, I can run e-mail/web/etc, and usage stays below 10%. All alerts still work fine. Also, if when esignal is displayed, if I tap the chart over one bar so that the current bar is not visible, usage drops below 2%.

    All my scripts have setComputeOnClose(true), so as I understand it they are not accessed until the next bar begins.

    So, I need to understand why drawing that one little bar chart can draw so much cpu usage? is there anything I'm doing wrong? Is the whole chart graphic re-drawn each time the price moves up/down one tick? Any ideas? would more RAM make this problem go away?

    Thanks
    Mark

  • #2
    eye candy

    Ok, so I removed all the eye candy. Specifically drawShape, drawShapeRelative, setting the background colors, and the problem goes away... runs below 8% consistantly. Guess just wondering why static colors would draw so much cpu power then? And why have these functions if they take over the machine?

    Mark

    Comment


    • #3
      Hello Mark,

      Sounds like you are not limiting the collection of drawn objects to any specific number. Depending on the amount of data being loaded and number of charts running, formulas that draw text, shapes or images you can chew up memory pretty fast. For an explanation on how to manage these objects to limit the number drawn by any given study, please see my reply in this post. If you have any trouble incorporating this routine into your study, post your code here and I'll take a look.

      Here's another thread that discusses the same problem. You can find other helpful threads by searching on the key word phrase "tag AND name" in this forum.
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        Mark,

        I believe with the clues you provided, that you have a large number of graphics objects being maintained.

        The more graphic objects you have, the longer it takes to update. A good number of graphics objects to maintain are 100, I would not recommend over 500.

        The fact that you switched desktops, and CPU load reduced, is telling. eSignal is not actively maintaining them and load will be reduced. As far as not being on the most current bar and it speeding up, I suspect it is a variant of the same phenomena.

        here is a snippet of code from an efs...

        PHP Code:
        drawLineRelative(D_Trend.x1-barcount,D_Trend.y1D_Trend.x2-barcountD_Trend.y2PS_SOLID3Color.red, ((Dn_Trend_ID++)+"lower trendline"));

        if (
        Dn_Trend_ID>100)Dn_Trend_ID=0
        Please notice how I am only maintaining a maximum of 100 lines by resetting the counter every every time it reaches 100.

        Let me know if this helps, if not, please post your code and either myself or someone else in the community will provide you some help.

        Comment


        • #5
          So how does one accomplish this with the efs2 drawShape(), when there is no ID tag specified?

          When using relative/absolute and limit to 20 items, should we see the older ones ie. >20 disappear or does esignal just stop keeping track of them?

          Mark

          Comment


          • #6
            Hello Mark,

            drawShape() also has the tagID parameter. The documentation was missing the tagID, I just updated it. You can apply the same logic as drawShapeRelative() for controlling the collection size.
            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment


            • #7
              Hi Mark,

              You are welcome. I believe the overhead associated with the drawshaperelative commands is due to your ability to draw them at any time. The new drawShape() command was created in when efs2 was introduced. The intent of this new command was to make it very easy to draw shapes (or text with drawText() ).

              Since the overhead issue was known at the time, I also believe the shapes that are drawn using this command have much less overhead, and therefore do not require the management of them like the older commands. i.e. ==>> more convenient, not difficult to use, but not as flexible as the older commands, and I believe, reduced overhead. As Jason indicated, the ability to index them is available as well.


              Happy Holidays,

              Comment


              • #8
                hmm, ok now it only tracks the last item. Here's what I've got...


                PHP Code:
                    if(drawtemp >= 100drawtemp 0;
                drawShape(Shape.SQUARE,BottomRow1,Color.blue,("trenID5"+(drawtemp++))); 
                Thanks
                Mark

                Comment


                • #9
                  this is probably due to drawtemp not being a global variable and it is being re-declared (set to zero) every iteration of main. Ensure it is declared outside of all functions var drawtemp = 0;

                  Comment


                  • #10
                    ah yes, works great now...

                    Thanks for your help.
                    Mark

                    Comment


                    • #11
                      Mark,

                      You are most welcome.

                      Comment

                      Working...
                      X