From 300b4c33ef6d346c4251d0421300df2f8bf11ea3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 31 Jan 2013 14:14:49 -0500 Subject: [PATCH] Added Python interpreter version directives and reorganized example scripts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau Signed-off-by: Mathieu Desnoyers --- bindings/python/examples/babeltrace_and_lttng.py | 12 +++++++++--- bindings/python/examples/example-api-test.py | 11 ++++++----- bindings/python/examples/{ => python2}/eventcount.py | 11 ++++++----- .../python/examples/{ => python2}/eventcountlist.py | 11 ++++++----- .../python/examples/{ => python2}/events_per_cpu.py | 11 ++++++----- bindings/python/examples/{ => python2}/histogram.py | 11 ++++++----- .../{ => python2}/output_format_modules/cairoplot.py | 0 .../output_format_modules/pprint_table.py | 2 +- .../{ => python2}/output_format_modules/series.py | 0 .../python/examples/{ => python2}/softirqtimes.py | 11 ++++++----- .../python/examples/{ => python2}/syscalls_by_pid.py | 11 ++++++----- bindings/python/examples/sched_switch.py | 11 ++++++----- tests/tests-python.py | 1 + 13 files changed, 59 insertions(+), 44 deletions(-) rename bindings/python/examples/{ => python2}/eventcount.py (98%) rename bindings/python/examples/{ => python2}/eventcountlist.py (98%) rename bindings/python/examples/{ => python2}/events_per_cpu.py (98%) rename bindings/python/examples/{ => python2}/histogram.py (99%) rename bindings/python/examples/{ => python2}/output_format_modules/cairoplot.py (100%) rename bindings/python/examples/{ => python2}/output_format_modules/pprint_table.py (99%) rename bindings/python/examples/{ => python2}/output_format_modules/series.py (100%) rename bindings/python/examples/{ => python2}/softirqtimes.py (99%) rename bindings/python/examples/{ => python2}/syscalls_by_pid.py (98%) diff --git a/bindings/python/examples/babeltrace_and_lttng.py b/bindings/python/examples/babeltrace_and_lttng.py index cb447965..cfd611f6 100644 --- a/bindings/python/examples/babeltrace_and_lttng.py +++ b/bindings/python/examples/babeltrace_and_lttng.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # babeltrace_and_lttng.py # # Babeltrace and LTTng example script @@ -59,18 +60,23 @@ ret = lttng.create(ses_name,trace_path) if ret < 0: raise LTTngError(lttng.strerror(ret)) +domain = lttng.Domain() +domain.type = lttng.DOMAIN_KERNEL + han = None -han = lttng.Handle(ses_name, lttng.Domain()) +han = lttng.Handle(ses_name, domain) if han is None: raise LTTngError("Handle not created") # Enabling all events -ret = lttng.enable_event(han, lttng.Event(), None) +event = lttng.Event() +event.type = lttng.EVENT_ALL +event.loglevel_type = lttng.EVENT_LOGLEVEL_ALL +ret = lttng.enable_event(han, event, None) if ret < 0: raise LTTngError(lttng.strerror(ret)) - # Start, wait, stop ret = lttng.start(ses_name) if ret < 0: diff --git a/bindings/python/examples/example-api-test.py b/bindings/python/examples/example-api-test.py index 104f2d55..fc59e249 100644 --- a/bindings/python/examples/example-api-test.py +++ b/bindings/python/examples/example-api-test.py @@ -1,18 +1,19 @@ +#!/usr/bin/env python3 # example_api_test.py -# +# # Babeltrace example script based on the Babeltrace API test script -# +# # Copyright 2012 EfficiOS Inc. -# +# # Author: Danny Serres -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. diff --git a/bindings/python/examples/eventcount.py b/bindings/python/examples/python2/eventcount.py similarity index 98% rename from bindings/python/examples/eventcount.py rename to bindings/python/examples/python2/eventcount.py index 5e96a434..079633c8 100644 --- a/bindings/python/examples/eventcount.py +++ b/bindings/python/examples/python2/eventcount.py @@ -1,18 +1,19 @@ +#!/usr/bin/env python2 # eventcount.py -# +# # Babeltrace event count example script -# +# # Copyright 2012 EfficiOS Inc. -# +# # Author: Danny Serres -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. diff --git a/bindings/python/examples/eventcountlist.py b/bindings/python/examples/python2/eventcountlist.py similarity index 98% rename from bindings/python/examples/eventcountlist.py rename to bindings/python/examples/python2/eventcountlist.py index 945a9606..1b42b4e7 100644 --- a/bindings/python/examples/eventcountlist.py +++ b/bindings/python/examples/python2/eventcountlist.py @@ -1,18 +1,19 @@ +#!/usr/bin/env python2 # eventcountlist.py -# +# # Babeltrace event count list example script -# +# # Copyright 2012 EfficiOS Inc. -# +# # Author: Danny Serres -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. diff --git a/bindings/python/examples/events_per_cpu.py b/bindings/python/examples/python2/events_per_cpu.py similarity index 98% rename from bindings/python/examples/events_per_cpu.py rename to bindings/python/examples/python2/events_per_cpu.py index be497ec8..6425b2df 100644 --- a/bindings/python/examples/events_per_cpu.py +++ b/bindings/python/examples/python2/events_per_cpu.py @@ -1,18 +1,19 @@ +#!/usr/bin/env python2 # events_per_cpu.py -# +# # Babeltrace events per cpu example script -# +# # Copyright 2012 EfficiOS Inc. -# +# # Author: Danny Serres -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. diff --git a/bindings/python/examples/histogram.py b/bindings/python/examples/python2/histogram.py similarity index 99% rename from bindings/python/examples/histogram.py rename to bindings/python/examples/python2/histogram.py index 44616a67..09618cb7 100644 --- a/bindings/python/examples/histogram.py +++ b/bindings/python/examples/python2/histogram.py @@ -1,18 +1,19 @@ +#!/usr/bin/env python2 # histogram.py -# +# # Babeltrace histogram example script -# +# # Copyright 2012 EfficiOS Inc. -# +# # Author: Danny Serres -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. diff --git a/bindings/python/examples/output_format_modules/cairoplot.py b/bindings/python/examples/python2/output_format_modules/cairoplot.py similarity index 100% rename from bindings/python/examples/output_format_modules/cairoplot.py rename to bindings/python/examples/python2/output_format_modules/cairoplot.py diff --git a/bindings/python/examples/output_format_modules/pprint_table.py b/bindings/python/examples/python2/output_format_modules/pprint_table.py similarity index 99% rename from bindings/python/examples/output_format_modules/pprint_table.py rename to bindings/python/examples/python2/output_format_modules/pprint_table.py index a7e82557..3a63d628 100644 --- a/bindings/python/examples/output_format_modules/pprint_table.py +++ b/bindings/python/examples/python2/output_format_modules/pprint_table.py @@ -1,5 +1,5 @@ # pprint_table.py -# +# # This module is used to pretty-print a table # Adapted from # http://ginstrom.com/scribbles/2007/09/04/pretty-printing-a-table-in-python/ diff --git a/bindings/python/examples/output_format_modules/series.py b/bindings/python/examples/python2/output_format_modules/series.py similarity index 100% rename from bindings/python/examples/output_format_modules/series.py rename to bindings/python/examples/python2/output_format_modules/series.py diff --git a/bindings/python/examples/softirqtimes.py b/bindings/python/examples/python2/softirqtimes.py similarity index 99% rename from bindings/python/examples/softirqtimes.py rename to bindings/python/examples/python2/softirqtimes.py index 903bf3ea..59905c15 100644 --- a/bindings/python/examples/softirqtimes.py +++ b/bindings/python/examples/python2/softirqtimes.py @@ -1,18 +1,19 @@ +#!/usr/bin/env python2 # softirqtimes.py -# +# # Babeltrace time of softirqs example script -# +# # Copyright 2012 EfficiOS Inc. -# +# # Author: Danny Serres -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. diff --git a/bindings/python/examples/syscalls_by_pid.py b/bindings/python/examples/python2/syscalls_by_pid.py similarity index 98% rename from bindings/python/examples/syscalls_by_pid.py rename to bindings/python/examples/python2/syscalls_by_pid.py index 3ae342e6..cf1d581d 100644 --- a/bindings/python/examples/syscalls_by_pid.py +++ b/bindings/python/examples/python2/syscalls_by_pid.py @@ -1,18 +1,19 @@ +#!/usr/bin/env python2 # syscall_by_pid.py -# +# # Babeltrace syscall by pid example script -# +# # Copyright 2012 EfficiOS Inc. -# +# # Author: Danny Serres -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. diff --git a/bindings/python/examples/sched_switch.py b/bindings/python/examples/sched_switch.py index 7ae834bc..d5ed25bd 100644 --- a/bindings/python/examples/sched_switch.py +++ b/bindings/python/examples/sched_switch.py @@ -1,18 +1,19 @@ +#!/usr/bin/env python3 # sched_switch.py -# +# # Babeltrace example script with sched_switch events -# +# # Copyright 2012 EfficiOS Inc. -# +# # Author: Danny Serres -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. diff --git a/tests/tests-python.py b/tests/tests-python.py index 0bd71c25..8695f61c 100644 --- a/tests/tests-python.py +++ b/tests/tests-python.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import unittest import sys from babeltrace import * -- 2.34.1