3 # Copyright (C) 2014 - David Goulet <dgoulet@efficios.com>
5 # This library is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation; version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this library; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 from time
import sleep
24 def cleanup(code
, agent
= None):
26 Cleanup agent and exit with given code.
35 except ImportError as e
:
36 print("LTTng Agent not found. Aborting")
41 Main for this test program. Based on the Java testing program that behaves
45 agent
= lttng_agent
.LTTngAgent()
46 ev1
= logging
.getLogger("python-ev-test1");
47 ev2
= logging
.getLogger("python-ev-test2");
50 nr_iter
= int(sys
.argv
[1])
51 wait_time
= int(sys
.argv
[2])
54 except IndexError as e
:
55 print("Missing arguments. Aborting")
56 cleanup(errno
.EINVAL
, agent
)
57 except ValueError as e
:
58 print("Invalid arguments. Aborting")
59 cleanup(errno
.EINVAL
, agent
)
62 fire_debug_ev
= int(sys
.argv
[3])
64 fire_second_ev
= int(sys
.argv
[4])
66 for i
in range(0, nr_iter
):
67 ev1
.info("%s fired" % ev1
.name
)
68 if fire_debug_ev
!= 0:
69 ev1
.debug("%s DEBUG fired" % ev1
.name
)
72 if fire_second_ev
!= 0:
73 ev2
.info("%s fired" % ev2
.name
)
75 if __name__
== "__main__":
This page took 0.045912 seconds and 5 git commands to generate.