aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Smythies <doug.smythies@gmail.com>2018-01-05 17:31:16 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-01-09 19:12:04 -0500
commitfbe313884d7ddd73ce457473cbdf3763f5b1d3da (patch)
treefefff741d584084e6984863c13532bca8e2043ac
parentcc85a6e2d097506dba2c5b8044884a3d22cc4a6e (diff)
tools/power/x86/intel_pstate_tracer: Free the trace buffer memory
The trace buffer memory should be, mostly, freed after the buffer has been output. This patch is required before a future patch that will allow the user to override the default, and specify the trace buffer memory allocation as a command line option. Signed-off-by: Doug Smythies <dsmythies@telus.net> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rwxr-xr-xtools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
index 0b24dd9d01ff..29f50d4cfea0 100755
--- a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
+++ b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
@@ -411,6 +411,16 @@ def set_trace_buffer_size():
411 print('IO error setting trace buffer size ') 411 print('IO error setting trace buffer size ')
412 quit() 412 quit()
413 413
414def free_trace_buffer():
415 """ Free the trace buffer memory """
416
417 try:
418 open('/sys/kernel/debug/tracing/buffer_size_kb'
419 , 'w').write("1")
420 except:
421 print('IO error setting trace buffer size ')
422 quit()
423
414def read_trace_data(filename): 424def read_trace_data(filename):
415 """ Read and parse trace data """ 425 """ Read and parse trace data """
416 426
@@ -583,4 +593,9 @@ for root, dirs, files in os.walk('.'):
583 for f in files: 593 for f in files:
584 fix_ownership(f) 594 fix_ownership(f)
585 595
596clear_trace_file()
597# Free the memory
598if interval:
599 free_trace_buffer()
600
586os.chdir('../../') 601os.chdir('../../')