class_docstr: The standalone CPU usage metric.
  
  Instances of this metric compute the average CPU usage as a float value.
  The metric starts tracking the CPU usage when the `update` method is called
  for the first time. That is, the tracking does not start at the time the
  constructor is invoked.
  
  Calling the `update` method more than twice will update the metric to the
  average usage between the first and the last call to `update`.
  
  The result, obtained using the `result` method, is the usage computed
  as stated above.
  
  The reset method will bring the metric to its initial state. By default
  this metric in its initial state will return an usage value of 0.
class_docstr_tok: ["The","standalone","CPU","usage","metric",".","Instances","of","this","metric","compute","the","average","CPU","usage","as","a","float","value",".","The","metric","starts","tracking","the","CPU","usage","when","the","`","update","`","method","is","called","for","the","first","time",".","That","is",",","the","tracking","does","not","start","at","the","time","the","constructor","is","invoked",".","Calling","the","`","update","`","method","more","than","twice","will","update","the","metric","to","the","average","usage","between","the","first","and","the","last","call","to","`","update","`",".","The","result",",","obtained","using","the","`","result","`","method",",","is","the","usage","computed","as","stated","above",".","The","reset","method","will","bring","the","metric","to","its","initial","state",".","By","default","this","metric","in","its","initial","state","will","return","an","usage","value","of","0","."]
docstr: Creates an instance of the standalone CPU usage metric.
  
  By default this metric in its initial state will return a CPU usage
  value of 0. The metric can be updated by using the `update` method
  while the average CPU usage can be retrieved using the `result` method.
docstr_tok: ["Creates","an","instance","of","the","standalone","CPU","usage","metric",".","By","default","this","metric","in","its","initial","state","will","return","a","CPU","usage","value","of","0",".","The","metric","can","be","updated","by","using","the","`","update","`","method","while","the","average","CPU","usage","can","be","retrieved","using","the","`","result","`","method","."]
code: def __init__(self):
      """
      Creates an instance of the standalone CPU usage metric.
  
      By default this metric in its initial state will return a CPU usage
      value of 0. The metric can be updated by using the `update` method
      while the average CPU usage can be retrieved using the `result` method.
      """
  
      self._mean_usage = Mean()
      """
          The mean utility that will be used to store the average usage.
          """
  
      self._process_handle: Optional[Process] = None
      """
          The process handle, lazily initialized.
          """
  
      self._first_update = True
      """
          An internal flag to keep track of the first call to the `update` method.
          """
  
imports: import os
  import warnings
  from typing import Optional, List
  from psutil import Process
  from avalanche.evaluation import Metric, PluginMetric, GenericPluginMetric
  from avalanche.evaluation.metrics import Mean
label_desc: Use image node_id 1 to create a new CPUUsage object from inherited base classes: Metric with example: obj = CPUUsage()