diff mbox series

[2/2] tools/power/x86/intel_pstate_tracer: Use pygnuplot package for Gnuplot

Message ID 20230915104057.132210-3-swapnil.sapkal@amd.com
State New
Headers show
Series Fix issues observed with selftests/amd-pstate | expand

Commit Message

Swapnil Sapkal Sept. 15, 2023, 10:40 a.m. UTC
In intel_pstate_tracer.py, Gnuplot is used to generate 2D plots.
In current implementation this tracer gives error while importing
the module because Gnuplot is imported from package Gnuplot-py which
does not support python 3.x. Fix this by using pygnuplot package to
import this module.

Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
---
 tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py      | 1 -
 tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Doug Smythies Sept. 17, 2023, 9:43 p.m. UTC | #1
On 2023.09.17 15:17 Doug wrote:
> On Fri, Sep 15, 2023 at 2:31 PM Mario Limonciello
>> On 9/15/2023 16:15, Doug Smythies wrote:
>>> On 2023.09.15 03:41 Swapnil Sapkal wrote:
...
>>> Not really related, but for a few years now I have been meaning to
>>> change the minimum python version prerequisite to >= 3.0 and
>>> to change the shebang line.
...
>>  Besides the shebang, you should also
>> use a helper like 2to3 to look for any other changes.

Hi Mario,

I was not aware of the 2to3 helper.
Thank you mentioning it.
The 2to3 helper only changed one line,
which I included in the minimum python version
patch I just submitted.

> I already did the python 3 patch in January, 2020:
> commit e749e09db30c38f1a275945814b0109e530a07b0
> tools/power/x86/intel_pstate_tracer: changes for python 3 compatibility
> 
> I haven't had any issues since, shebang aside.

... Doug
Swapnil Sapkal Sept. 19, 2023, 7:36 a.m. UTC | #2
Hello Doug,

Sorry for delay in response.

On 9/18/2023 3:13 AM, Doug Smythies wrote:
> On 2023.09.17 15:17 Doug wrote:
>> On Fri, Sep 15, 2023 at 2:31 PM Mario Limonciello
>>> On 9/15/2023 16:15, Doug Smythies wrote:
>>>> On 2023.09.15 03:41 Swapnil Sapkal wrote:
> ...
>>>> Not really related, but for a few years now I have been meaning to
>>>> change the minimum python version prerequisite to >= 3.0 and
>>>> to change the shebang line.
> ...
>>>   Besides the shebang, you should also
>>> use a helper like 2to3 to look for any other changes.
> 
> Hi Mario,
> 
> I was not aware of the 2to3 helper.
> Thank you mentioning it.
> The 2to3 helper only changed one line,
> which I included in the minimum python version
> patch I just submitted.
>
I tried with installing python3-gnuplot and it worked for me. Initially I
tried with other packages in prerequisites and it didn't worked for me.

I will send v2 removing this patch.

>> I already did the python 3 patch in January, 2020:
>> commit e749e09db30c38f1a275945814b0109e530a07b0
>> tools/power/x86/intel_pstate_tracer: changes for python 3 compatibility
>>
>> I haven't had any issues since, shebang aside.
> 
> ... Doug
> 
> 
--
Thanks and Regards,
Swapnil
diff mbox series

Patch

diff --git a/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py b/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
index 2448bb07973f..14f8d81f91de 100755
--- a/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
+++ b/tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py
@@ -27,7 +27,6 @@  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'))
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 ec3323100e1a..68412abdd7d4 100755
--- a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
+++ b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
@@ -32,7 +32,7 @@  import re
 import signal
 import sys
 import getopt
-import Gnuplot
+from pygnuplot import gnuplot
 from numpy import *
 from decimal import *
 
@@ -295,7 +295,7 @@  def common_all_gnuplot_settings(output_png):
 def common_gnuplot_settings():
     """ common gnuplot settings. """
 
-    g_plot = Gnuplot.Gnuplot(persist=1)
+    g_plot = gnuplot.Gnuplot(persist=1)
 #   The following line is for rigor only. It seems to be assumed for .csv files
     g_plot('set datafile separator \",\"')
     g_plot('set ytics nomirror')