LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading CPU Usage in 64 BIT labview using pdh.dll dosent work.

its calling 64 bit version of pdh.dll from labview 64 bit enviroment 

if i manually specify path for 32 bit version of pdh.dll (Sustem32WOW) VI gets broken arrow ..

0 Kudos
Message 11 of 15
(905 Views)

@AtulS wrote:

if i manually specify path for 32 bit version of pdh.dll (Sustem32WOW) VI gets broken arrow ..


As mentioned, don't do that. Let Windows resolve that path...

0 Kudos
Message 12 of 15
(890 Views)

yes

kept to system32 path only.. (64 Bit version)

still not working..Smiley Sad

0 Kudos
Message 13 of 15
(885 Views)

Without seeing what Windows API functions you call it is difficult to say what could be the problem. You added a snippet but that is in LabVIEW 2018 format and I only have LabVIEW 2016 installed on my machine (I'm working on a long term project in that version with RT and FPGA and various industrial protocol libraries installed, which is pretty critical and can't risk to mess up the LabVIEW installation for that). 

 

So can you append a downsaved version of your VI to a post? The one where you claim to have changed all handles correctly!

From a somewhat educated guess I would think that your first function is PdhOpenQueryA() whose three parameters are all pointer sized variables! Then you use PdhAddCounterA() with the first being a handle, so pointer sized, and the 3rd being a DWORD_PTR, again pointer sized, and last but not least another handle, hence pointer sized and of course passed as reference, hence passed as Pointer to Value.

 

I think you should get the idea from here on!

 

And PdhGetFormatterCounterValue() might be also tricky. Its third paramater is an unsigned 32 bit integer but passed by reference! And the last is a pointer to a struct whose second element is a uniion of various dataypes, some of them being 8 byte long. So unless you pass in an array of two 64 bit integers you are bound to receive bad data. Personally I would make it a cluster with an unsigned 32 bit for the status, another 32 bit integer as filler and last but not least a 64 bit integer for the union element. Then Unflatten that value into a double, or an int32, or int64 depending on the value returned in the lpdwType variable.

Rolf Kalbermatter
My Blog
0 Kudos
Message 14 of 15
(867 Views)

thanks for reply

i will try what u have suggested..

0 Kudos
Message 15 of 15
(848 Views)