Forum Discussion

MadhuLambu's avatar
MadhuLambu
Contributor
2 years 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

  • 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
      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.