03-05-2007 11:01 AM
Yes XP SP2.
I tried % Processor Time and that graphs gives me value of higher 90%. Actual CPU usuage is less then 10%.
03-05-2007 03:28 PM
From CVI example code,
status = Initialize_System(); //I added status
//status = 0 no error
// Create .NET performance counter objects
status = System_Diagnostics_PerformanceCounter__Create_2(&gCPUCounter, "Processor",
"% Processor Time", "_Total", 0);//I added status
//status = -6571
error = CDotNetGetErrorDescription(status); //I added this
//error=Target invoked by Labwindows/CVI .net library threw an exception.
Any idea why?
03-07-2007 07:45 AM
03-07-2007 08:09 AM
Thanks for suggestions.
It did not work. Same results.
I have CVI version 8.0.1 but my RTE is 8.1. Does it make any difference?
03-08-2007 02:03 PM
03-08-2007 04:25 PM
03-08-2007 05:06 PM
03-08-2007 08:26 PM
When I run your program I get this error.
The thread 0x5f4 has exited with code 0 (0x0).
The thread '<No Name>' (0x828) has exited with code 0 (0x0).
'CpuUsageTest.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\apatelsh\Desktop\Test CPU_Usage\Test CPU_Usage\CpuUsage\CpuUsageTest\bin\Debug\CpuUsageTest.exe', Symbols loaded.
A first chance exception of type 'System.InvalidOperationException' occurred in System.dll
An unhandled exception of type 'System.InvalidOperationException' occurred in System.dll
Additional information: Category does not exist.
'CpuUsageTest.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', No symbols loaded.
The thread '<No Name>' (0xf6c) has exited with code 0 (0x0).
The program '[3324] CpuUsageTest.vshost.exe: Managed' has exited with code -532459699 (0xe0434f4d).
03-09-2007 09:54 AM - edited 03-09-2007 09:54 AM
Howdy Sheetal,
Hmmm.... that's a little weird that you are receiving errors issues in
LabWindows/CVI, LabVIEW, and with Visual Studio executables.
What brought up a possibly light bulb in my head was the Visual Studio error
that you posted which mentioned that the Category does not exist.
When you create a Performance Counter object in .NET, you must specify the Category to which you will be monitoring (in this case, the category was Processor). Thus, I found a Microsoft document entitled Some performance objects and counters are not available in the System Monitor tool on your Windows X.... Essentially, if you have paging turned off, you don't get access to those counters. I changed my virtual memory to no paging, and I receive the same Visual Studio error and CVI behavior you mentioned. That Microsoft document says to either contact Microsoft for the hotfix or gives you a workaround of basically changing your paging memory.
Anyway, this should fix your problem. Let me know what happens!
Best Regards,
Message Edited by Jonathan N on 03-09-2007 09:55 AM
03-09-2007 12:04 PM
Hi Jon,
Thanks for your help. Yes I had page file off. I changed to system managed file. Restarted laptop and I tried CVI, labview and C sharp project but no success. I get same result.
Then I waited 10 minutes and tried again and it worked with all programs.. Interesting...Again thank you very much for help. This solves my problem.