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. getting disk throughput

getting disk throughput

Scheduled Pinned Locked Moved C / C++ / MFC
performancetutorialquestion
7 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.
  • T Offline
    T Offline
    T1TAN
    wrote on last edited by
    #1

    Is there a known way of getting disk throughput? I suppose it has something to do with performance counters, but I'm not sure how to use them properly.. :doh: Does anyone know a good article, link, or something..? I'd be most gratefull :cool: --- http://sprdsoft.cmar-net.org - We Sprd You Softly Our site features contents and several images. All of this is very weird. In the end, war is not about who's right, it's about who's left.

    D 1 Reply Last reply
    0
    • T T1TAN

      Is there a known way of getting disk throughput? I suppose it has something to do with performance counters, but I'm not sure how to use them properly.. :doh: Does anyone know a good article, link, or something..? I'd be most gratefull :cool: --- http://sprdsoft.cmar-net.org - We Sprd You Softly Our site features contents and several images. All of this is very weird. In the end, war is not about who's right, it's about who's left.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      T1TAN wrote:

      I suppose it has something to do with performance counters, but I'm not sure how to use them properly...

      But do you know which one you are interested in?


      "Take only what you need and leave the land as you found it." - Native American Proverb

      T 1 Reply Last reply
      0
      • D David Crow

        T1TAN wrote:

        I suppose it has something to do with performance counters, but I'm not sure how to use them properly...

        But do you know which one you are interested in?


        "Take only what you need and leave the land as you found it." - Native American Proverb

        T Offline
        T Offline
        T1TAN
        wrote on last edited by
        #3

        Hm. Good question indeed. I believe it's this one: LogicalDisk|PhysicalDisk\Disk Bytes/sec "Indicates the rate at which bytes are transferred and is the primary measure of disk throughput. To analyze transfer data based on reads and writes, use Disk Read Bytes/sec and Disk Write Bytes/sec, respectively." This[^] is all I could find.. :doh: --- http://sprdsoft.cmar-net.org - We Sprd You Softly Our site features contents and several images. All of this is very weird. In the end, war is not about who's right, it's about who's left.

        D 1 Reply Last reply
        0
        • T T1TAN

          Hm. Good question indeed. I believe it's this one: LogicalDisk|PhysicalDisk\Disk Bytes/sec "Indicates the rate at which bytes are transferred and is the primary measure of disk throughput. To analyze transfer data based on reads and writes, use Disk Read Bytes/sec and Disk Write Bytes/sec, respectively." This[^] is all I could find.. :doh: --- http://sprdsoft.cmar-net.org - We Sprd You Softly Our site features contents and several images. All of this is very weird. In the end, war is not about who's right, it's about who's left.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          T1TAN wrote:

          LogicalDisk|PhysicalDisk\Disk Bytes/sec

          It would look something like:

          HQUERY hQuery = NULL;
          PDH_STATUS pdhStatus = PdhOpenQuery(NULL, 0, &hQuery);

          // Make counter path
          PDH_COUNTER_PATH_ELEMENTS pdhCpe;
          pdhCpe.szMachineName = TEXT("server");
          pdhCpe.szObjectName = TEXT("LogicalDisk");
          pdhCpe.szInstanceName = TEXT("C:");
          pdhCpe.szParentInstance = NULL;
          pdhCpe.dwInstanceIndex = -1;
          pdhCpe.szCounterName = TEXT("Disk Bytes/sec");
          DWORD dwBufferSize = sizeof(szBytesSec);
          TCHAR szBytesSec[128];
          pdhStatus = PdhMakeCounterPath(&pdhCpe, szBytesSec, &dwBufferSize, 0);

          // Add counter
          HCOUNTER hBytesSec;
          pdhStatus = PdhAddCounter(hQuery, szBytesSec, 0, &hBytesSec);

          // Get the data
          pdhStatus = PdhCollectQueryData(hQuery);

          // Format counter value
          PDH_FMT_COUNTERVALUE pdhfmtBytesSec;
          pdhStatus = PdhGetFormattedCounterValue(hBytesSec, PDH_FMT_LONG, NULL, &pdhfmtBytesSec);

          pdhStatus = PdhCloseQuery(hQuery);


          "Take only what you need and leave the land as you found it." - Native American Proverb

          -- modified at 9:28 Monday 12th December, 2005

          T 1 Reply Last reply
          0
          • D David Crow

            T1TAN wrote:

            LogicalDisk|PhysicalDisk\Disk Bytes/sec

            It would look something like:

            HQUERY hQuery = NULL;
            PDH_STATUS pdhStatus = PdhOpenQuery(NULL, 0, &hQuery);

            // Make counter path
            PDH_COUNTER_PATH_ELEMENTS pdhCpe;
            pdhCpe.szMachineName = TEXT("server");
            pdhCpe.szObjectName = TEXT("LogicalDisk");
            pdhCpe.szInstanceName = TEXT("C:");
            pdhCpe.szParentInstance = NULL;
            pdhCpe.dwInstanceIndex = -1;
            pdhCpe.szCounterName = TEXT("Disk Bytes/sec");
            DWORD dwBufferSize = sizeof(szBytesSec);
            TCHAR szBytesSec[128];
            pdhStatus = PdhMakeCounterPath(&pdhCpe, szBytesSec, &dwBufferSize, 0);

            // Add counter
            HCOUNTER hBytesSec;
            pdhStatus = PdhAddCounter(hQuery, szBytesSec, 0, &hBytesSec);

            // Get the data
            pdhStatus = PdhCollectQueryData(hQuery);

            // Format counter value
            PDH_FMT_COUNTERVALUE pdhfmtBytesSec;
            pdhStatus = PdhGetFormattedCounterValue(hBytesSec, PDH_FMT_LONG, NULL, &pdhfmtBytesSec);

            pdhStatus = PdhCloseQuery(hQuery);


            "Take only what you need and leave the land as you found it." - Native American Proverb

            -- modified at 9:28 Monday 12th December, 2005

            T Offline
            T Offline
            T1TAN
            wrote on last edited by
            #5

            Thanx! Will give it a try and let you know how it worked:cool: Do you think I could use this code with CPerfCounters class located in this[^] article? Is there a way to get the maximum bytes per sec?? I would like to get the percentage of max disk throughput if possible:) thanx again DC:rose: --- http://sprdsoft.cmar-net.org - We Sprd You Softly Our site features contents and several images. All of this is very weird. In the end, war is not about who's right, it's about who's left.

            D 1 Reply Last reply
            0
            • T T1TAN

              Thanx! Will give it a try and let you know how it worked:cool: Do you think I could use this code with CPerfCounters class located in this[^] article? Is there a way to get the maximum bytes per sec?? I would like to get the percentage of max disk throughput if possible:) thanx again DC:rose: --- http://sprdsoft.cmar-net.org - We Sprd You Softly Our site features contents and several images. All of this is very weird. In the end, war is not about who's right, it's about who's left.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              T1TAN wrote:

              Do you think I could use this code with CPerfCounters class located in this[^] article?

              Not sure. How about asking the article's author?

              T1TAN wrote:

              Is there a way to get the maximum bytes per sec??

              Sure. Each time the value is obtained, store the highest value in a separate variable.


              "Take only what you need and leave the land as you found it." - Native American Proverb

              T 1 Reply Last reply
              0
              • D David Crow

                T1TAN wrote:

                Do you think I could use this code with CPerfCounters class located in this[^] article?

                Not sure. How about asking the article's author?

                T1TAN wrote:

                Is there a way to get the maximum bytes per sec??

                Sure. Each time the value is obtained, store the highest value in a separate variable.


                "Take only what you need and leave the land as you found it." - Native American Proverb

                T Offline
                T Offline
                T1TAN
                wrote on last edited by
                #7

                DavidCrow wrote:

                Not sure. How about asking the article's author?

                Em, yeah..that seems like a good idea..:-O

                DavidCrow wrote:

                Sure. Each time the value is obtained, store the highest value in a separate variable.

                Oh I didn't mean that highest value, what I meant was: is there a way to get the maximum throughput that could ever happen on a specific drive?:doh: Not the highest one I've ever measured. I'm not really sure this is possible. I suppose each drive has its own throughput limit..:confused: --- http://sprdsoft.cmar-net.org - We Sprd You Softly Our site features contents and several images. All of this is very weird. In the end, war is not about who's right, it's about who's left.

                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