#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-only # -*- coding: utf-8 -*- # """ This utility can be used to debug and tune the performance of the
AMD P-State driver. It imports intel_pstate_tracer to analyze AMD P-State
trace event.
Prerequisites:
Python version 2.7.x or higher
gnuplot 5.0 or higher
gnuplot-py 1.8 or higher
(Most of the distributions have these required packages. They may be called
gnuplot-py, phython-gnuplot or phython3-gnuplot, gnuplot-nox, ... )
Kernel config for Linux trace is enabled
see print_help(): for Usage and Output details
""" from __future__ import print_function from datetime import datetime import subprocess import os import time import re import signal import sys import getopt import Gnuplot from numpy import * from decimal import *
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "intel_pstate_tracer")) import intel_pstate_tracer as ipt
for line in data.splitlines():
search_obj = \
re.search(r'(^(.*?)\[)((\d+)[^\]])(.*?)(\d+)([.])(\d+)(.*?amd_min_perf=)(\d+)(.*?amd_des_perf=)(\d+)(.*?amd_max_perf=)(\d+)(.*?freq=)(\d+)(.*?mperf=)(\d+)(.*?aperf=)(\d+)(.*?tsc=)(\d+)'
, line)
if search_obj:
cpu = search_obj.group(3)
cpu_int = int(cpu)
cpu = str(cpu_int)
if cpu_int > current_max_cpu:
current_max_cpu = cpu_int # Now separate the main overall csv file into per CPU csv files.
ipt.split_csv(current_max_cpu, cpu_mask)
def signal_handler(signal, frame):
print(' SIGINT: Forcing cleanup before exit.') if interval:
ipt.disable_trace(trace_file)
ipt.clear_trace_file()
ipt.free_trace_buffer()
sys.exit(0)
os.chdir('results') if os.path.exists(test_name):
print('The test name directory already exists. Please provide a unique test name. Test re-run not supported, yet.')
sys.exit()
os.mkdir(test_name)
ipt.fix_ownership(test_name)
os.chdir(test_name)
cur_version = sys.version_info
print('python version (should be >= 2.7):')
print(cur_version)
cleanup_data_files()
if interval:
file_name = "/sys/kernel/tracing/trace"
ipt.clear_trace_file()
ipt.set_trace_buffer_size(memory)
ipt.enable_trace(trace_file)
time.sleep(int(interval))
ipt.disable_trace(trace_file)
current_max_cpu = 0
read_trace_data(file_name, cpu_mask)
if interval:
ipt.clear_trace_file()
ipt.free_trace_buffer()
if graph_data_present == False:
print('No valid data to plot')
sys.exit(2)
for cpu_no in range(0, current_max_cpu + 1):
plot_per_cpu_freq(cpu_no)
plot_per_cpu_des_perf(cpu_no)
plot_per_cpu_load(cpu_no)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.