Forum Discussion

MadhuLambu's avatar
MadhuLambu
Occasional Contributor
12 months ago

GPU Usage

Dear Community,

Am automating a desktop application where I need to log the GPU Usage. Does anyone know how to?

TIA,

Madhu

4 Replies

  • MadhuLambu's avatar
    MadhuLambu
    Occasional Contributor

    I should have been clearer in my question. Am looking for getting the GPU Usage % similar to how we get CPU Usage. (am using Javascript)

    Sys.Process("app").CPUUsage;

     

    • MadhuLambu's avatar
      MadhuLambu
      Occasional Contributor
      function getGPUUsage() {
        var perfCounter = Sys.OleObject("PerformanceCounter");
        perfCounter.CategoryName = "GPU Engine";
        perfCounter.CounterName = "Utilization Percentage";
        perfCounter.InstanceName = "_Total";

      for(var i=0;i<10;i++)
      {
        Log.Message( perfCounter.NextValue());
      aqUtils.Delay(1000);
      }
      }

      I tried this function as suggested in one of the search results, but it gives an error at the first line.

      JScript runtime error.
      Invalid class string: cannot obtain ClassID.

      I guess am close. Does anyone know how to get the PerformanceCounter object to work? I do have .net framework runtime 4.8.1.