Results 1 to 2 of 2

Thread: Cpu Plot walkthrough

  1. #1
    Join Date
    Oct 2008
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Cpu Plot walkthrough

    hi!!

    i am a qwt newbie and have been assigned a task to draw a plot very similar to the cpu plot example. Unfortunately i am unable to understand this example.I know the logic of parsing the /proc/stat and converting the statistics into percentages.

    What i did not get is the qwt part. How the scale was set,the background,the time scale,the run time information etc etc.Can anyone give me a simple walk through to get me started...or at least explain the sequence of execution...i would be really great full.

    thanks !!

    -max

  2. #2
    Join Date
    Oct 2008
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Cpu Plot walkthrough

    any body?...or atleast help me understand this:

    void CpuPlot::timerEvent(QTimerEvent *)
    {
    for ( int i = dataCount; i > 0; i-- ) //wht is the initial value of dataCount?
    {
    for ( int c = 0; c < NCpuData; c++ )
    {
    if ( i < HISTORY )
    data[c].data[i] = data[c].data[i-1];
    }
    }

    cpuStat.statistic(data[User].data[0], data[System].data[0]);

    data[Total].data[0] = data[User].data[0] +
    data[System].data[0];
    data[Idle].data[0] = 100.0 - data[Total].data[0];

    if ( dataCount < HISTORY ) //60
    dataCount++;

    for ( int j = 0; j < HISTORY; j++ )
    timeData[j]++;

    //***set scale**********//
    setAxisScale(QwtPlot::xBottom,
    timeData[HISTORY - 1], timeData[0]);

    for ( int c = 0; c < NCpuData; c++ )
    {
    data[c].curve->setRawData(
    timeData, data[c].data, dataCount);
    }

    replot();
    }

    what is happening here?.

    thanks

Similar Threads

  1. Replies: 7
    Last Post: 22nd September 2008, 22:05
  2. Problem saving a plot
    By kalos80 in forum Qwt
    Replies: 2
    Last Post: 10th July 2008, 08:31
  3. Reg multiple plots in Qwt
    By Tavit in forum Qwt
    Replies: 4
    Last Post: 23rd June 2008, 13:43
  4. Replies: 15
    Last Post: 27th May 2008, 01:46
  5. Replies: 0
    Last Post: 27th May 2008, 01:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.