Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8481283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:31:28+00:00 2026-06-10T19:31:28+00:00

I am working on a project that is collecting data about performance, like the

  • 0

I am working on a project that is collecting data about performance, like the Performance Monitor does.

However, when I running a monitor on pages/sec, it is givning a different result than the Performance Monitor.
I am thinking it is because the performance counter not giving all the decimals, and the average calculation becomes inaccurate.

My code UPDATED:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading;
using System.Net;
using System.Management;
using System.Net.NetworkInformation;

namespace PerformanceMonitor
{
    class Program
    {

        static void Main(string[] args)
        {
       List<float> pagesSec = new List<float>();
        PerformanceCounter memoryPages = new PerformanceCounter("Memory", "Pages/sec");

        while (count < 50)
        {
            pagesSecValue = memoryPages.NextValue();
            pagesSec.Add(pagesSecValue);


           Console.WriteLine("Pages: " + pagesSecValue);
           count++;

            Thread.Sleep(1000);
            Console.Clear();
        }

Console.WriteLine("Avg pages/sec: " + pagesSec.Average());

 Console.ReadLine();
        }
}
}

While running the program, most of the time I get 0 printed on the console.

Results:
My program: 4,06349
Windows Performance Monitor: 12,133

Why the difference?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:31:30+00:00Added an answer on June 10, 2026 at 7:31 pm

    You’re doing different calculations than the performance counter. What you’re doing is getting the pages per second once a second for 50 seconds and getting the average of those 50 numbers. One, clearly the performance counter is working with data for a longer period of time. Two, this isn’t a useful average. The performance counter is effectively taking a much higher sample. For example, what do you think would happen if the pages per second values did this over a period of 2 seconds:
    0 .5 1 1.5 2
    5 15 6 20 4

    And your code sampled at 0, 1 and 2 seconds? Your “average” would be 5 and the performance counter (if it sampled at .5 seconds, which it doesn’t) would be 10.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project that connects to Oracle. It Brings back data through
I am working on a project that involves a lot of data, and at
I am working on a project where we have data models that look basically
I have a working project that Im amending, it crashes after trying to use
I'm working on project that lets users choose some scientific authors and columnists and
Im working on a project that has an implementation of JOSSO in place. We
I'm working on a project that requires to convert html email into text. Below
I'm working on a project that downloads a zip file and unzips locally. The
I'm working on a project that is trying to use context-free grammars for parsing
I am working on a project that already has begun being developed. ON some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.