1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

exe to read GPU-Z shared memory data?

Discussion in 'GPU-Z' started by Irios, Apr 12, 2012.

  1. Irios New Member

    Joined:
    Apr 12, 2012
    Messages:
    9 (0.01/day)
    Thanks Received:
    2
    (The original thread on this matter seems to have been locked, so I'm making a new one here.)


    I would love to see someone make a command-line exe that will let you output GPU-Z data values into a shell window :D

    I want to implement data from GPU-Z into MRTG graphs.


    If you dont know MRTG... it will read data from SNMP, WMI or other sources, and create graphs.

    MRTG requires 4 lines of data when sending values to it's script. (Info here, scroll down to 'External Monitoring Scripts')

    Code:
    number value 1
    number value 2
    system uptime (in human readable form)
    system name
    The two first lines is what's interesting. The two last lines are easy to create using windows shell commands. But for the sake of userfriendlyness, you could also let the exe generate the two last lines.

    For example, you use various command line argument to select what graphics card you want to pull data from, and then you select what data will be used for value 1 and value 2
    Code:
    readgpu-z.exe /gpu:1 /sensor1:temp /sensor2:rpmpercent
    would give you this result
    Code:
    85.0
    41
    1 day 4 hours 33 minutes 25 seconds
    WorkStation03
    It's very important there is only outputted raw numeric values on the two first lines, with . used for decimal point (not comma)

    To create an exe that could be used for many other applications (and not only MRTG) perhaps just make it output a single value, and not pre-formatted for MRTG?

    There already exists a similar command line exe for SpeedFan, and it would be so neat to have one for GPU-Z as well.
    See my example graphs here...
    Server: http://demux.net/mrtg/deckard/summary.html
    Workstation: http://demux.net/mrtg/tyrell/summary.html



    EDIT: GPU-Z would need an option for starting minimized (sys tray) so you can put GPU-Z in the startup folder.
     
    Last edited: Apr 12, 2012
  2. JohnnyUT New Member

    Joined:
    Jul 14, 2008
    Messages:
    7 (0.00/day)
    Thanks Received:
    4
    Hi, I could write this for you. However, as far as I know, there is no possibility to select the GPU. An .exe file could just access the data that GPU-Z is currently displaying, which is the data of the currently selected GPU in GPU-Z. ;)

    @EDIT: Try to set "execution" to "minimized" in the "properties" of GPU-Z's link in the startup folder. This might work.
     
    Irios says thanks.
  3. W1zzard

    W1zzard Administrator Staff Member

    Joined:
    May 14, 2004
    Messages:
    14,965 (3.92/day)
    Thanks Received:
    11,770
    gpuz has a -card parameter that selects the card on startup.

    e.g.
    Code:
    gpu-z.exe -card 1
    the first card is 1, the second card is 2, and so on

    for minimized, this should work:
    [​IMG]
     
  4. Irios New Member

    Joined:
    Apr 12, 2012
    Messages:
    9 (0.01/day)
    Thanks Received:
    2
    I didnt even take into consideration using start with the minimized argument as I figured it would simply minimize to the task bar, but I see that GPU-Z is actually minimized to the sys tray :)

    So the contents of the shared memory depends on what gpu is active in the GUI hmmm
    Maybe the developer could implement a feature that allows several GPUs to be active?

    Or maybe this solution....
    I've noticed you can have more than one instance of GPU-Z.
    What happens if you have two instances of GPU-Z...? Would this program that reads the shared memory know the differences between these two instances if they have different process names (i.e. renamed the GPU-Z exe)? Maybe have a command line argument for the readgpu-z program so you can select the correct instance. (i.e. /instance:gpu-z-2.exe)

    Does shared memory contain all the data being read from the gpu, or only the current tab?

    I would be very grateful for help with this.
    Also, I'm quite sure your program would be quite popular among MRTG Windows users :)
     
  5. JohnnyUT New Member

    Joined:
    Jul 14, 2008
    Messages:
    7 (0.00/day)
    Thanks Received:
    4
    As far as I can tell, there's only one shared memory "slot" and only data of one GPU fits into this slot at the same time. At least it has been like this 4 years ago. At this time I had 2 GPUs myself and I "fixed" this issue by running 2 GPU-Z instances at the same time and by periodically reading the data from the shared memory. It was totally random, which core's data was in the shared memory when I read it. However, since one GPU core had 900 Mhz and the other had 901 Mhz, I managed to distinguish the read data by this single difference.

    I don't know if there is some special data value in GPU-Z's shared memory that uniquely identifies the GPU or core. Maybe W1zzard can tell us. If there was such a value, I could build some workaround that would work as follows:

    -) Program A periodically reads from the shared memory and stores the data with the clearly identified GPU/core. This program has to run in the background.
    -) Now you can call program B with a parameter indicating which GPU's value you want to output. This program gets the latest value from program A and produces the output that you want.

    In the mean time, I've created the tool you asked for without multi GPU support. You can download it here:

    http://www.file-upload.net/download-4267232/readgpuz.zip.html

    You have to put both, the .exe and the .dll file into the same folder, otherwise it won't work. If you encounter problems, you might be missing the required .NET Framework Runtime 4, which you can download for free here:

    http://www.microsoft.com/download/en/details.aspx?id=17718

    Feel free to ask if anything isn't working as intended. ;)
     
    Last edited: Apr 12, 2012
    Irios says thanks.
  6. Irios New Member

    Joined:
    Apr 12, 2012
    Messages:
    9 (0.01/day)
    Thanks Received:
    2
    Holy cow, JohhnyUT, that was fast :D
    Superthanks!

    I'm doing some testing now, poking and probing your readgpuz.exe in a shell to see what comes out of it. And so far it's looking perfect :D

    A minor cosmetic thing... I see you're truncating some of the values rather than doing a proper rounding.
    For example VDCC 0,8750 becomes 0.87 in the output.
    To be honest, dont be afraid of showing the whole value with all it's decimals.

    Ok, for this thing to run you must have the whole .NET Framework Runtime 4 to be installed? I havent got a system here without this installed, so I'm not to able to test to see if it works without it.
    (I'm working on a comprehensive FAQ/HOWTO on running MRTG on Windows, and this is useful information to put there.)
     
  7. JohnnyUT New Member

    Joined:
    Jul 14, 2008
    Messages:
    7 (0.00/day)
    Thanks Received:
    4
    Yeah, i truncated the output to 2 digits after the comma for simplicity, but i can adjust it to show all digits, if you like.

    Yes, .NET Framework Runtime 4 is absolutely necessary, as the tool is programmed in C# for this specific version. However, as no special .NET 4 and 3 features are required, I could also drop the requirement to .NET 2, if requested. But it shouldn't be such a big deal, as .NET 4 is quite widespread. ;)
     
  8. Irios New Member

    Joined:
    Apr 12, 2012
    Messages:
    9 (0.01/day)
    Thanks Received:
    2
    Runnnig readgpuz.exe without any arguments is done in a jiffy - but it takes quite a long time for the program to do it's job when you use arguments. Maybe a whole second or so. When grabbing a bunch of GPU-Z values sequentially in a bat file it takes a while to finish (and it it might create some timing issues when I'm running this script on a remote remotely system.)
    Why does it take less time for it to output all the values in the summary compared to only outputting two values?


    EDIT: ok thanks for the .NET info, much appreciated :)
     
  9. JohnnyUT New Member

    Joined:
    Jul 14, 2008
    Messages:
    7 (0.00/day)
    Thanks Received:
    4
    You are right, this is strange. I did some tests and the reason for the delay is the request for the system uptime. I managed to make the request faster, so now the delay should be gone. I changed the download link in the post above. ;)
     
    Irios says thanks.
  10. Irios New Member

    Joined:
    Apr 12, 2012
    Messages:
    9 (0.01/day)
    Thanks Received:
    2
    Yeah the delay is gone :)
    I'm currently using your program on my system... gonna play some rounds of BF3 to get some pretty graphs.
    I'll post some graphs in a little while to show what the results are.

    A small note on using the minimze argument on GPU-Z... it only minimizes to the task bar, and not straight to the sys tray, like suspected.
     
  11. Irios New Member

    Joined:
    Apr 12, 2012
    Messages:
    9 (0.01/day)
    Thanks Received:
    2
    Ok, here are some graphs.

    http://demux.net/mrtg/tyrell/summary_gpu.html

    Data is collected every 5 mins, and graphs are generated and updated automatically.
    At the time of writing this, the script has only been running for two hours while playing some BF3 (without vertical sync to push the GPU a little harder than usual) and doing some websurfing, so there's not much stuff there.
    This workstation is turned off at night - and while the system is off, the server automatically stops collecting data - that's why there are 'gaps' with zero values in the graphs.
    ('GPU Temp' data is provided by SpeedFan)

    EDIT: Another page showing more stats from my workstation: http://demux.net/mrtg/tyrell/summary.html
     
    Last edited: Apr 13, 2012
    streetfighter 2 says thanks.
  12. streetfighter 2

    streetfighter 2 New Member

    Joined:
    Jul 26, 2010
    Messages:
    1,658 (1.07/day)
    Thanks Received:
    732
    Location:
    Philly
    Solaris17 says thanks.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page