From: Hector Santos on

Mani wrote:

> Hi,
>
> I Have no idea about performance counter in windows vista. Can any one pelase tell me, Is it possible to reset the peformance counter in windows vista by using MFC with ATL?. If it possible means, please explain me.
>
> ---


Mani,

I posted a MFC class here back in Feb 2010, in the kernel forum. You
can see via google groups:

http://groups.google.com/group/microsoft.public.win32.programmer.kernel/msg/a57916adf856dcef

That should work under any OS.

--
HLS
From: Joseph M. Newcomer on
Note that for RDTSC to work correctly, it must be preceded by a serializing instruction.
The only serializing instruction legal in user space is CPUID. So any class which
encapsulates RDTSC must be checked to see that it is correctly written.

Also, QueryPerformanceCounter works, and does the right serializing.
joe

On Sun, 18 Apr 2010 00:09:10 +0200, Hans-J. Ude <news(a)s237965939.online.de> wrote:

>Mani schrieb:
>
>> I Have no idea about performance counter in windows vista. Can any one pelase tell me,
>> Is it possible to reset the peformance counter in windows vista by using MFC with ATL?.
>> If it possible means, please explain me.
>
>Somebody wrote a class called CCPUTicker. It encapsulates the RDTSC
>assembly instruction. It's old and I don't know of multiple cpu(cores)
>support, neither of OS version support. And I doubt that there is any
>way at all to modify the counter. But have a look.
>
>Hans
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on
There are several problems with this class

It is not Unicode-aware, using 8-bit characters in some places but is an odd mix of
Unicode-aware and non-Unicode-aware code..

It uses printf, making it unsuitable for use in a Windows app.

But it looks like not a bad place to start.
joe



On Sat, 17 Apr 2010 19:56:42 -0400, Hector Santos <sant9442(a)nospam.gmail.com> wrote:

>
>Mani wrote:
>
>> Hi,
>>
>> I Have no idea about performance counter in windows vista. Can any one pelase tell me, Is it possible to reset the peformance counter in windows vista by using MFC with ATL?. If it possible means, please explain me.
>>
>> ---
>
>
>Mani,
>
>I posted a MFC class here back in Feb 2010, in the kernel forum. You
>can see via google groups:
>
>http://groups.google.com/group/microsoft.public.win32.programmer.kernel/msg/a57916adf856dcef
>
>That should work under any OS.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Hector Santos on
Well, I'll be the first to admit i am not a UNICODE person. I don't
think in those terms and personally I think its a big kludge. A
programmer should not be "thinking" that he got to do thing special
things typecasting, thing about different functions, etc, just to deal
with text. Its not NORMAL. Maybe thats the flavor today, I sincerely
hope it isn't the future of languages.

But this code was not compiled for unicode, the commented CL compile
statement should of provided that hinit, and it as pulled from a
treasure chest of code we have, and just because I have to be playing
with UNICODE at the time, I decided to pepper whatever there was to
make it "unicode." For example, the load file used std I/O and I
threw in the CStdIO class usage. In addition, so I forgot one line in
the Dump "Subroutine" that won't be used normally.

The posted code serves its purpose and quite handy when you define a
input file for your counters for quick measurements. I guess if
someone uses a UNICODE note pad editor and you have DOUBLE BYTE junk
added to the text file, then the load file "subroutine" needs some
UNICODE/ANSI logic reading logic. Either he uses ANSI in the editor
or the fix it themselves of UNI-GARBAGE is important to them. :)

--
HLS


Joseph M. Newcomer wrote:

> There are several problems with this class
>
> It is not Unicode-aware, using 8-bit characters in some places but is an odd mix of
> Unicode-aware and non-Unicode-aware code..
>
> It uses printf, making it unsuitable for use in a Windows app.
>
> But it looks like not a bad place to start.
> joe
>
>
>
> On Sat, 17 Apr 2010 19:56:42 -0400, Hector Santos <sant9442(a)nospam.gmail.com> wrote:
>
>> Mani wrote:
>>
>>> Hi,
>>>
>>> I Have no idea about performance counter in windows vista. Can any one pelase tell me, Is it possible to reset the peformance counter in windows vista by using MFC with ATL?. If it possible means, please explain me.
>>>
>>> ---
>>
>> Mani,
>>
>> I posted a MFC class here back in Feb 2010, in the kernel forum. You
>> can see via google groups:
>>
>> http://groups.google.com/group/microsoft.public.win32.programmer.kernel/msg/a57916adf856dcef
>>
>> That should work under any OS.
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm



--
HLS