Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Doug Smythies and committed by
Rafael J. Wysocki
fbe31388 cc85a6e2

+15
+15
tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
··· 411 411 print('IO error setting trace buffer size ') 412 412 quit() 413 413 414 + def 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 + 414 424 def read_trace_data(filename): 415 425 """ Read and parse trace data """ 416 426 ··· 592 582 for root, dirs, files in os.walk('.'): 593 583 for f in files: 594 584 fix_ownership(f) 585 + 586 + clear_trace_file() 587 + # Free the memory 588 + if interval: 589 + free_trace_buffer() 595 590 596 591 os.chdir('../../')