[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1] tools/xentrace/xentrace_format: Add python 3 compatibility



On Mon, Sep 11, 2023 at 02:45:56PM +0100, Andrew Cooper wrote:
> On 11/09/2023 2:44 pm, Javi Merino wrote:
> > On Mon, Sep 11, 2023 at 11:52:43AM +0100, Andrew Cooper wrote:
> >> On 06/09/2023 2:14 pm, Javi Merino wrote:
> >>> diff --git a/tools/xentrace/xentrace_format 
> >>> b/tools/xentrace/xentrace_format
> >>> index 5ff85ae2e8..166ebae325 100644
> >>> --- a/tools/xentrace/xentrace_format
> >>> +++ b/tools/xentrace/xentrace_format
> >>> @@ -4,11 +4,15 @@
> >>>  
> >>>  # Program for reformatting trace buffer output according to 
> >>> user-supplied rules
> >>>  
> >>> +from __future__ import division
> >>> +from __future__ import print_function
> >>> +from __future__ import unicode_literals
> >>> +from builtins import str
> >>> +from past.utils import old_div
> >> This adds a new dependency on a package we (upstream Xen) don't
> >> currently use.  AFAICT, it's only for...
> >>
> >>> @@ -223,7 +232,7 @@ while not interrupted:
> >>>              last_tsc[cpu] = tsc
> >>>  
> >>>          if mhz:
> >>> -            tsc = tsc / (mhz*1000000.0)
> >>> +            tsc = old_div(tsc, (mhz*1000000.0))
> >> ... this, which is always int / float and doesn't fall into Py2's
> >> int/int behaviour in the first place.
> >>
> >> I'm pretty sure the code can just stay as it is, without needing to use
> >> old_div().
> > Ok, I will the dependency on python3 future and the old_div() for v2.
> 
> My point is that I don't think we need this dependency at all, and I
> don't think you need to change this line at all.

Yes.  And I forgot to add "remove" and the sentence made no sense.
What I meant was:

Ok, I will remove the dependency on python3 future and the old_div() for v2.

Cheers,
Javi



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.