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

Re: [Minios-devel] [UNIKRAFT PATCH 2/3] support/scripts: reorganise tracing scripts



Hi Yuri,

I think this patch should be integrated with the tracing series.

Cheers,
Costin

On 5/23/19 7:29 PM, Yuri Volchkov wrote:
> Now main scripts are provided under the package uk_trace. This allows
> to remove shady calculation of the scripts directory in order to
> append the module search path (considering that uk-gdb.py is now
> generated whith the path hardocded path).
> 
> Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
> ---
>  support/scripts/uk-gdb.py                              | 10 +++++-----
>  support/scripts/{unikraft => uk_trace}/__init__.py     |  0
>  .../scripts/{unikraft/trace.py => uk_trace/parse.py}   |  0
>  support/scripts/{ => uk_trace}/trace.py                |  7 ++-----
>  4 files changed, 7 insertions(+), 10 deletions(-)
>  rename support/scripts/{unikraft => uk_trace}/__init__.py (100%)
>  rename support/scripts/{unikraft/trace.py => uk_trace/parse.py} (100%)
>  rename support/scripts/{ => uk_trace}/trace.py (96%)
> 
> diff --git a/support/scripts/uk-gdb.py b/support/scripts/uk-gdb.py
> index 9ae8ee66..2cf38244 100644
> --- a/support/scripts/uk-gdb.py
> +++ b/support/scripts/uk-gdb.py
> @@ -40,7 +40,7 @@ import tempfile, shutil
>  scripts_dir = os.path.dirname(os.path.realpath(__file__))
>  sys.path.append(scripts_dir)
>  
> -import unikraft.trace as trace
> +import uk_trace.parse as parse
>  
>  type_char = gdb.lookup_type('char')
>  type_void = gdb.lookup_type('void')
> @@ -78,14 +78,14 @@ def save_traces(out):
>      # least keyvals are always stored first. However, ideally, next
>      # versions should just have modifications at the very end to keep
>      # compatibility with previously collected data.
> -    pickler.dump(trace.get_keyvals(elf))
> +    pickler.dump(parse.get_keyvals(elf))
>      pickler.dump(elf)
>      pickler.dump(PTR_SIZE)
>      # We are saving raw trace buffer here. Another option is to pickle
>      # already parsed samples. But in the chosen case it is a lot
>      # easier to debug the parser, because python in gdb is not very
>      # convenient for development.
> -    pickler.dump(trace.get_tp_sections(elf))
> +    pickler.dump(parse.get_tp_sections(elf))
>      pickler.dump(get_trace_buffer())
>  
>  class uk(gdb.Command):
> @@ -99,8 +99,8 @@ class uk_trace(gdb.Command):
>                               gdb.COMPLETE_COMMAND, True)
>      def invoke(self, arg, from_tty):
>          elf = gdb.current_progspace().filename
> -        samples = trace.sample_parser(trace.get_keyvals(elf),
> -                                      trace.get_tp_sections(elf),
> +        samples = parse.sample_parser(parse.get_keyvals(elf),
> +                                      parse.get_tp_sections(elf),
>                                        get_trace_buffer(), PTR_SIZE)
>          for sample in samples:
>              print(sample)
> diff --git a/support/scripts/unikraft/__init__.py 
> b/support/scripts/uk_trace/__init__.py
> similarity index 100%
> rename from support/scripts/unikraft/__init__.py
> rename to support/scripts/uk_trace/__init__.py
> diff --git a/support/scripts/unikraft/trace.py 
> b/support/scripts/uk_trace/parse.py
> similarity index 100%
> rename from support/scripts/unikraft/trace.py
> rename to support/scripts/uk_trace/parse.py
> diff --git a/support/scripts/trace.py b/support/scripts/uk_trace/trace.py
> similarity index 96%
> rename from support/scripts/trace.py
> rename to support/scripts/uk_trace/trace.py
> index 636cd2dd..5fafca63 100755
> --- a/support/scripts/trace.py
> +++ b/support/scripts/uk_trace/trace.py
> @@ -38,10 +38,7 @@ import pickle
>  import subprocess
>  from tabulate import tabulate
>  
> -scripts_dir = os.path.dirname(os.path.realpath(__file__))
> -sys.path.append(scripts_dir)
> -
> -import unikraft.trace as trace
> +import parse
>  
>  @click.group()
>  def cli():
> @@ -64,7 +61,7 @@ def parse_tf(trace_file):
>          print("Problem occurred during reading the tracefile: %s" % 
> str(inst))
>          quit(-1)
>  
> -    return trace.sample_parser(keyvals, tp_defs, trace_buff, ptr_size)
> +    return parse.sample_parser(keyvals, tp_defs, trace_buff, ptr_size)
>  
>  @cli.command()
>  @click.argument('trace_file', type=click.Path(exists=True), 
> default='tracefile')
> 

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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