Skip to content

Commit

Permalink
tools/power/x86/intel_pstate_tracer: Free the trace buffer memory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Doug Smythies authored and Rafael J. Wysocki committed Jan 10, 2018
1 parent cc85a6e commit fbe3138
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,16 @@ def set_trace_buffer_size():
print('IO error setting trace buffer size ')
quit()

def free_trace_buffer():
""" Free the trace buffer memory """

try:
open('/sys/kernel/debug/tracing/buffer_size_kb'
, 'w').write("1")
except:
print('IO error setting trace buffer size ')
quit()

def read_trace_data(filename):
""" Read and parse trace data """

Expand Down Expand Up @@ -583,4 +593,9 @@ def read_trace_data(filename):
for f in files:
fix_ownership(f)

clear_trace_file()
# Free the memory
if interval:
free_trace_buffer()

os.chdir('../../')

0 comments on commit fbe3138

Please sign in to comment.