Click here to Skip to main content
15,891,248 members
Articles / Programming Languages / C++

Get CPU Usage with GetSystemTimes

Rate me:
Please Sign up or sign in to vote.
4.27/5 (26 votes)
20 Dec 2004Public Domain1 min read 349.7K   7.4K   59  
How to get CPU usage with GetSystemTimes
In this article, you will find a solution for getting CPU usage with the help of GetSystemTimes.
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
#pragma once

#define     _WIN32_WINNT    (0x0500)    // WE ARE WinNT 5.0 SPECIFIC !!!
#define     UNICODE
#define     _UNICODE
#pragma  warning( disable:4201) // nonstandard extension used : nameless struct/union
#pragma  warning( disable:4710) // warning C4710: function 'toto' not expanded

#include <crtdbg.h>
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>

#include <iostream>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Web Developer
United Kingdom United Kingdom
http://dev.jesover.net

Comments and Discussions