File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ def __init__(self):
2020
2121 self .default_railgate_status = self ._read_railgate_file ()
2222
23+ self .has_changed_clocks = False
24+
2325 @staticmethod
2426 def get_dev_path ():
2527 """Get the path to device core clock control in /sys"""
@@ -65,6 +67,7 @@ def _read_clock_file(self, fname):
6567
6668 def _write_clock_file (self , fname , value ):
6769 """Write a frequency value to a core clock control file"""
70+ self .has_changed_clocks = True
6871 available_files = ("min_freq" , "max_freq" )
6972 if fname not in available_files :
7073 raise ValueError (f"Illegal filename value: { fname } , must be one of { available_files } " )
@@ -107,8 +110,9 @@ def reset_clock(self):
107110 self ._write_railgate_file (self .default_railgate_status )
108111
109112 def __del__ (self ):
110- # restore original core clocks
111- self .reset_clock ()
113+ # restore original core clocks, if changed
114+ if self .has_changed_clocks :
115+ self .reset_clock ()
112116
113117
114118class TegraObserver (BenchmarkObserver ):
You can’t perform that action at this time.
0 commit comments