[PATCH v2] run.py: allow multiple arguments to --trace

1 view
Skip to first unread message

Tomasz Grabiec

unread,
Apr 2, 2014, 10:51:21 AM4/2/14
to osv...@googlegroups.com
Allow to pass --trace multiple times to run.py so that the command
line interface is the same as for OSv's loader, eg:

scripts/run.py --trace sched_wait* --trace memory_*

Signed-off-by: Tomasz Grabiec <tgra...@cloudius-systems.com>
---
scripts/run.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/run.py b/scripts/run.py
index c6a40e0..0264069 100755
--- a/scripts/run.py
+++ b/scripts/run.py
@@ -55,7 +55,7 @@ def set_imgargs(options):
execute = execute.replace('java.so', 'java.so ' + debug_options)

if options.trace:
- execute = '--trace=%s %s' % (options.trace, execute)
+ execute = ' '.join('--trace=%s' % name for name in options.trace) + ' ' + execute

if options.trace_backtrace:
execute = '--trace-backtrace ' + execute
@@ -354,8 +354,8 @@ if (__name__ == "__main__"):
help = "redirect the API port (8000) for user-mode networking")
parser.add_argument("--pass-args", action="append",
help = "pass arguments to underlying hypervisor (e.g. qemu)")
- parser.add_argument("--trace", action="store",
- help="enable tracepoint")
+ parser.add_argument("--trace", default=[], action='append',
+ help="enable tracepoints")
parser.add_argument("--trace-backtrace", action="store_true",
help="enable collecting of backtrace at tracepoints")
cmdargs = parser.parse_args()
--
1.8.3.2

Tomasz Grabiec

unread,
Apr 8, 2014, 6:51:02 AM4/8/14
to Osv Dev
ping?

Nadav Har'El

unread,
Apr 8, 2014, 6:59:22 AM4/8/14
to Tomasz Grabiec, Osv Dev
On Wed, Apr 2, 2014 at 5:51 PM, Tomasz Grabiec <tgra...@cloudius-systems.com> wrote:
Allow to pass --trace multiple times to run.py so that the command
line interface is the same as for OSv's loader, eg:

  scripts/run.py --trace sched_wait* --trace memory_*

Given that we can already do 

    scripts/run.py --trace sched_wait*,memory_*

which is even shorter, I don't think this patch adds much. But on the other hand, it also doesn't bother me that we add this possibility for those who want to use it, so

Reviewed-by: Nadav Har'El <n...@cloudius-systems.com>


--
1.8.3.2

--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Tomasz Grabiec

unread,
Apr 8, 2014, 7:06:59 AM4/8/14
to Nadav Har'El, Osv Dev
On Tue, Apr 8, 2014 at 12:59 PM, Nadav Har'El <n...@cloudius-systems.com> wrote:
On Wed, Apr 2, 2014 at 5:51 PM, Tomasz Grabiec <tgra...@cloudius-systems.com> wrote:
Allow to pass --trace multiple times to run.py so that the command
line interface is the same as for OSv's loader, eg:

  scripts/run.py --trace sched_wait* --trace memory_*

Given that we can already do 

    scripts/run.py --trace sched_wait*,memory_*

which is even shorter, I don't think this patch adds much. But on the other hand, it also doesn't bother me that we add this possibility for those who want to use it, so

The value is that the command line interface will now be the same for both run.py and OSv loader:

 scripts/run.py --trace A --trace B

 scripts/run.py -e " --trace A --trace B  ..."

That's one thing less to keep in mind.

Nadav Har'El

unread,
Apr 8, 2014, 7:13:46 AM4/8/14
to Tomasz Grabiec, Osv Dev
On Tue, Apr 8, 2014 at 2:06 PM, Tomasz Grabiec <tgra...@cloudius-systems.com> wrote:
On Tue, Apr 8, 2014 at 12:59 PM, Nadav Har'El <n...@cloudius-systems.com> wrote:
On Wed, Apr 2, 2014 at 5:51 PM, Tomasz Grabiec <tgra...@cloudius-systems.com> wrote:
Allow to pass --trace multiple times to run.py so that the command
line interface is the same as for OSv's loader, eg:

  scripts/run.py --trace sched_wait* --trace memory_*

Given that we can already do 

    scripts/run.py --trace sched_wait*,memory_*

which is even shorter, I don't think this patch adds much. But on the other hand, it also doesn't bother me that we add this possibility for those who want to use it, so

The value is that the command line interface will now be the same for both run.py and OSv loader:

 scripts/run.py --trace A --trace B

 scripts/run.py -e " --trace A --trace B  ..."

That's one thing less to keep in mind.

I have nothing to keep in mind because also for the loader I always use a comma: scripts/run.py -e "--trace A,B ...".

But we don't need to choose. Let's support both if you like it (and like you said, the loader already supports both). It's not like it costs us anything.


Reviewed-by: Nadav Har'El <n...@cloudius-systems.com>

Commit Bot

unread,
Apr 9, 2014, 4:59:31 AM4/9/14
to osv...@googlegroups.com, tgra...@cloudius-systems.com
From: Tomasz Grabiec <tgra...@cloudius-systems.com>

run.py: allow multiple arguments to --trace

Allow to pass --trace multiple times to run.py so that the command
line interface is the same as for OSv's loader, eg:

scripts/run.py --trace sched_wait* --trace memory_*

Reviewed-by: Nadav Har'El <n...@cloudius-systems.com>
Signed-off-by: Tomasz Grabiec <tgra...@cloudius-systems.com>
Signed-off-by: Pekka Enberg <pen...@cloudius-systems.com>

---
diff --git a/scripts/run.py b/scripts/run.py
--- a/scripts/run.py
+++ b/scripts/run.py
@@ -55,7 +55,7 @@ def set_imgargs(options):
execute = execute.replace('java.so', 'java.so ' + debug_options)

if options.trace:
- execute = '--trace=%s %s' % (options.trace, execute)
+ execute = ' '.join('--trace=%s' % name for name in options.trace)
+ ' ' + execute

if options.trace_backtrace:
execute = '--trace-backtrace ' + execute
@@ -354,8 +354,8 @@ def main(options):
Reply all
Reply to author
Forward
0 new messages