From 4297c1b2d07fec7f50b70e26e3adb4d062b19e15 Mon Sep 17 00:00:00 2001 From: gnn Date: Sat, 12 May 2012 20:38:18 +0000 Subject: Add the remaining scripts from the DTraceToolkit, version 0.99, to the vendor tree. http://www.brendangregg.com/dtrace.html#DTraceToolkit --- Code/Perl/func_abc.pl | 20 ++++++++++++++++++++ Code/Perl/func_malloc.pl | 18 ++++++++++++++++++ Code/Perl/func_slow.pl | 20 ++++++++++++++++++++ Code/Perl/hello.pl | 3 +++ Code/Perl/hello_strict.pl | 5 +++++ 5 files changed, 66 insertions(+) create mode 100755 Code/Perl/func_abc.pl create mode 100755 Code/Perl/func_malloc.pl create mode 100755 Code/Perl/func_slow.pl create mode 100755 Code/Perl/hello.pl create mode 100755 Code/Perl/hello_strict.pl (limited to 'Code/Perl') diff --git a/Code/Perl/func_abc.pl b/Code/Perl/func_abc.pl new file mode 100755 index 0000000..394f1c2 --- /dev/null +++ b/Code/Perl/func_abc.pl @@ -0,0 +1,20 @@ +#!./perl -w + +sub func_c { + print "Function C\n"; + sleep 1; +} + +sub func_b { + print "Function B\n"; + sleep 1; + func_c(); +} + +sub func_a { + print "Function A\n"; + sleep 1; + func_b(); +} + +func_a(); diff --git a/Code/Perl/func_malloc.pl b/Code/Perl/func_malloc.pl new file mode 100755 index 0000000..5340c82 --- /dev/null +++ b/Code/Perl/func_malloc.pl @@ -0,0 +1,18 @@ +#!./perl -w + +sub func_c { + print "Function C\n"; +} + +sub func_b { + print "Function B\n"; + my $b = "B" x 100_000; + func_c(); +} + +sub func_a { + print "Function A\n"; + func_b(); +} + +func_a(); diff --git a/Code/Perl/func_slow.pl b/Code/Perl/func_slow.pl new file mode 100755 index 0000000..f32d09e --- /dev/null +++ b/Code/Perl/func_slow.pl @@ -0,0 +1,20 @@ +#!./perl -w + +sub func_c { + print "Function C\n"; + for (my $i = 0; $i < 3000000; $i++) { my $j = $i + 1; } +} + +sub func_b { + print "Function B\n"; + for (my $i = 0; $i < 2000000; $i++) { my $j = $i + 1 ; } + func_c(); +} + +sub func_a { + print "Function A\n"; + for (my $i = 0; $i < 1000000; $i++) { my $j = $i + 1; } + func_b(); +} + +func_a(); diff --git a/Code/Perl/hello.pl b/Code/Perl/hello.pl new file mode 100755 index 0000000..3ca70a2 --- /dev/null +++ b/Code/Perl/hello.pl @@ -0,0 +1,3 @@ +#!./perl + +print "Hello World!\n"; diff --git a/Code/Perl/hello_strict.pl b/Code/Perl/hello_strict.pl new file mode 100755 index 0000000..78003a9 --- /dev/null +++ b/Code/Perl/hello_strict.pl @@ -0,0 +1,5 @@ +#!./perl -w + +use strict; + +print "Hello World!\n"; -- cgit v1.1