Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Performance counters

Performance counters

Scheduled Pinned Locked Moved C / C++ / MFC
performance
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    locoone
    wrote on last edited by
    #1

    im using a performance counter to monitor my bandwidth but its not displaying like it does in performance monitor in my code it jumps from 0 to a 34523452(positive) number to a -45735399negittive) number in performance monitor it runs steady with what azureus says im uploading at when azureus says upload is around 226 KB/s performance monitor says around 244000 bytes/s here is the code that seems to not be right its running on a 1 sec timer PDH_FMT_COUNTERVALUE fmtValue; pdhStatus = PdhCollectQueryData(hQuery); if (ERROR_SUCCESS != pdhStatus) { ErrorExit("PdhCollectQueryData"); cleanup(); } pdhStatus = PdhCollectQueryData(hQuery); pdhStatus = PdhGetFormattedCounterValue (hCounter, PDH_FMT_DOUBLE, &ctrType, &fmtValue); if (pdhStatus == ERROR_SUCCESS) { sentinfo.Empty(); sentinfo.Format("%.3d", fmtValue.doubleValue); GetDlgItem(IDC_SENT)->SetWindowText(sentinfo); UpdateWindow(); } else { ErrorExit("PdhGetFormattedCounterValue"); cleanup(); } MSG msg; if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if you see what aint right please let me know.

    V 1 Reply Last reply
    0
    • L locoone

      im using a performance counter to monitor my bandwidth but its not displaying like it does in performance monitor in my code it jumps from 0 to a 34523452(positive) number to a -45735399negittive) number in performance monitor it runs steady with what azureus says im uploading at when azureus says upload is around 226 KB/s performance monitor says around 244000 bytes/s here is the code that seems to not be right its running on a 1 sec timer PDH_FMT_COUNTERVALUE fmtValue; pdhStatus = PdhCollectQueryData(hQuery); if (ERROR_SUCCESS != pdhStatus) { ErrorExit("PdhCollectQueryData"); cleanup(); } pdhStatus = PdhCollectQueryData(hQuery); pdhStatus = PdhGetFormattedCounterValue (hCounter, PDH_FMT_DOUBLE, &ctrType, &fmtValue); if (pdhStatus == ERROR_SUCCESS) { sentinfo.Empty(); sentinfo.Format("%.3d", fmtValue.doubleValue); GetDlgItem(IDC_SENT)->SetWindowText(sentinfo); UpdateWindow(); } else { ErrorExit("PdhGetFormattedCounterValue"); cleanup(); } MSG msg; if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if you see what aint right please let me know.

      V Offline
      V Offline
      Viorel
      wrote on last edited by
      #2

      Since fmtValue.doubleValue is a float value, I do not think the "%d" format specifier is appropriate. You should try "%f" or "%g":

      sentinfo.Format( "%.3f", fmtValue.doubleValue);
      

      I hope this helps.

      L 1 Reply Last reply
      0
      • V Viorel

        Since fmtValue.doubleValue is a float value, I do not think the "%d" format specifier is appropriate. You should try "%f" or "%g":

        sentinfo.Format( "%.3f", fmtValue.doubleValue);
        

        I hope this helps.

        L Offline
        L Offline
        locoone
        wrote on last edited by
        #3

        where can i see a list of all the different one i can use %d %f %g %s %u ect.....?

        V 1 Reply Last reply
        0
        • L locoone

          where can i see a list of all the different one i can use %d %f %g %s %u ect.....?

          V Offline
          V Offline
          Viorel
          wrote on last edited by
          #4

          In MSDN documentation. For example: http://msdn2.microsoft.com/en-us/library/56e442dc(VS.80).aspx[^].

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups