← Index
Performance Profile   « block view • line view • sub view »
For /wise/base/deliv/dev/bin/framedepth
  Run on Fri May 28 15:23:26 2010
Reported on Fri May 28 15:26:21 2010

File/wise/base/static/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi/PGPLOT.pm
Statements Executed12
Total Time0.000305 seconds

Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
19320.099690.09969PGPLOT::pgscr (xsub)
2120.039680.03968PGPLOT::pgbeg (xsub)
34620.020440.02044PGPLOT::pgptext (xsub)
699120.018450.01845PGPLOT::pgdraw (xsub)
21220.009740.00974PGPLOT::pgpt (xsub)
2120.001640.00164PGPLOT::pgpap (xsub)
2120.000340.00034PGPLOT::bootstrap (xsub)
52120.000320.00032PGPLOT::pgmove (xsub)
33520.000170.00017PGPLOT::pgsci (xsub)
26720.000110.00011PGPLOT::pgsch (xsub)
3227.6e-57.6e-5PGPLOT::pgqtxt (xsub)
3223.9e-53.9e-5PGPLOT::pgstbg (xsub)
2122.4e-52.4e-5PGPLOT::pgswin (xsub)
3222.3e-52.3e-5PGPLOT::pgqwin (xsub)
3221.9e-51.9e-5PGPLOT::pgsclp (xsub)
2121.9e-51.9e-5PGPLOT::pgsvp (xsub)
2121.4e-51.4e-5PGPLOT::pgqcs (xsub)
2121.2e-51.2e-5PGPLOT::pgqvp (xsub)
00000PGPLOT::BEGIN

LineStmts.Exclusive
Time
Avg.Code
1
2package PGPLOT;
3
4# Module to allow calling of PGPLOT from Perl
5#
6# Karl Glazebrook [email: kgb@aaoepp.aao.gov.au]
7#
8# WWW info: http://www.aao.gov.au/local/www/kgb/pgperl/
9
1011.0e-61.0e-6$VERSION="2.19";
11
1232.9e-59.7e-6use Exporter;
# spent 51µs making 1 call to Exporter::import
1330.000196.4e-5use DynaLoader;
# spent 5µs making 1 call to import
14
1511.0e-51.0e-5@ISA = qw(Exporter DynaLoader);
1613.1e-53.1e-5@EXPORT = qw( pgarro pgask pgaxis pgband pgbbuf pgbeg pgbegin pgbin pgbox
17pgcirc pgclos pgconb pgconf pgconl pgcons pgcont pgconx pgctab pgcurs pgcurse pgdraw
18pgebuf pgend pgenv pgeras pgerrb pgerr1 pgerrx pgerry pgetxt pgfunt pgfunx
19pgfuny pggray pghi2d pghist pgiden pgimag pglab pglabel pglcur pgldev
20pglen pgline pgmove pgmtxt pgmtext pgncur pgncurse pgnumb pgolin pgopen pgpage
21pgadvance pgpanl pgpap pgpaper pgpixl pgpnts pgpoly pgpt pgpt1 pgpoint pgptxt
22pgptext pgqah pgqcf pgqch pgqci pgqclp pgqcir pgqcol pgqcr pgqcs pgqdt pgqfs pgqhs
23pgqid pgqinf pgqitf pgqls pgqlw pgqndt pgqpos pgqtbg pgqtxt pgqvp pgqvsz pgqwin
24pgrect pgrnd pgrnge pgsah pgsave pgunsa pgscf pgsch pgsci pgscir pgsclp pgscr
25pgscrl pgscrn pgsfs pgshls pgshs pgsitf pgslct pgsls pgslw pgstbg pgsubp pgsvp
26pgvport pgswin pgwindow pgtbox pgtick pgtext pgupdt pgvect pgvsiz pgvsize
27pgvstd pgvstand pgwedg pgwnad );
28
2921.6e-58.0e-6if($^O =~ /mswin32/i) {
# spent 4.32ms making 1 call to DynaLoader::bootstrap
30 local $DynaLoader::dl_dlext = 'xs.dll';
31 bootstrap PGPLOT $VERSION;
32 }
33
34else {bootstrap PGPLOT $VERSION}
35
36# Exit with OK status
37
3812.7e-52.7e-51;
39
40__DATA__
41
42=head1 NAME
43
44PGPLOT - allow subroutines in the PGPLOT graphics library to be called from Perl.
45
46=head1 SYNOPSIS
47
48 use PGPLOT;
49
50 pgbegin(0,"/xserve",1,1);
51 pgenv(1,10,1,10,0,0);
52 pglabel('X','Y','My plot');
53 pgpoint(7,[2..8],[2..8],17);
54
55 # etc...
56
57 pgend;
58
59=head1 DESCRIPTION
60
61Originally developed in the olden days of Perl4 (when it was known
62as 'pgperl' due to the necessity of making a special perl executable)
63PGPLOT is now a dynamically loadable perl module which interfaces
64to the FORTRAN graphics library of the same name.
65
66PGPLOT, originally developed as a FORTRAN library, is now available with
67C bindings (which the Perl module uses), though a FORTRAN compiler is
68still required to build it.
69
70For every PGPLOT C/FORTRAN function the module provides an equivalent
71Perl function with the same arguments. Thus the user of the module should
72refer to the PGPLOT manual to learn all about how to use PGPLOT and for
73the complete list of available functions. This manual comes with the
74PGPLOT distribution and is also available at the WWW address:
75
76http://astro.caltech.edu/~tjp/pgplot/
77
78Also refer to the extensive set of test scripts (C<test*.p>) included
79in the module distribution for examples of usage of all kinds of
80PGPLOT routines.
81
82How the FORTRAN/C function calls map on to Perl calls is detailed below.
83
84
85=head2 ARGUMENT MAPPING - SIMPLE NUMBERS AND ARRAYS
86
87This is more or less as you might expect - use Perl scalars
88and Perl arrays in place of FORTRAN/C variables and arrays.
89
90Any FORTRAN REAL/INTEGER/CHARACTER* scalar variable maps to a
91Perl scalar (Perl doesn't care about the differences between
92strings and numbers and ints and floats).
93
94Thus you can say:
95
96To draw a line to point (42,$x):
97
98 pgdraw(42,$x);
99
100To plot 10 points with data in Perl arrays C<@x> and C<@y> with plot symbol
101no. 17. Note the Perl arrays are passed by reference:
102
103 pgpoint(10, \@x, \@y, 17);
104
105You can also use the old Perl4 style:
106
107 pgpoint(10, *x, *y, 17);
108
109but this is deprecated in Perl5.
110
111Label the axes:
112
113 pglabel("X axis", "Data units", $label);
114
115Draw ONE point, see how when C<N=1> C<pgpoint()> can take a scalar as well as
116a array argument:
117
118 pgpoint(1, $x, $y, 17);
119
120
121=head2 ARGUMENT MAPPING - IMAGES AND 2D ARRAYS
122
123Many of the PGPLOT commands (e.g. C<pggray>) take 2D arrays as
124arguments. Several schemes are provided to allow efficient use
125from Perl:
126
127=over 4
128
129=item 1.
130
131Simply pass a reference to a 2D array, e.g:
132
133 # Create 2D array
134
135 $x=[];
136 for($i=0; $i<128; $i++) {
137 for($j=0; $j<128; $j++) {
138 $$x[$i][$j] = sqrt($i*$j);
139 }
140 }
141 pggray( $x, 128, 128, ...);
142
143=item 2.
144
145Pass a reference to a 1D array:
146
147 @x=();
148 for($i=0; $i<128; $i++) {
149 for($j=0; $j<128; $j++) {
150 $x[$i][$j] = sqrt($i*$j);
151 }
152 }
153 pggray( \@x, 128, 128, ...);
154
155Here @x is a 1D array of 1D arrays. (Confused? - see perldata(1)).
156Alternatively @x could be a flat 1D array with 128x128 elements, 2D
157routines such as C<pggray()> etc. are programmed to do the right thing
158as long as the number of elements match.
159
160=item 3.
161
162If your image data is packed in raw binary form into a character string
163you can simply pass the raw string. e.g.:
164
165 read(IMG, $img, 32768);
166 pggray($img, $xsize, $ysize, ...);
167
168Here the C<read()> function reads the binary data from a file and the
169C<pggray()> function displays it as a grey-scale image.
170
171This saves unpacking the image data in to a potentially very large 2D
172perl array. However the types must match. The string must be packed as a
173C<"f*"> for example to use C<pggray>. This is intended as a short-cut for
174sophisticated users. Even more sophisticated users will want to download
175the C<PDL> module which provides a wealth of functions for manipulating
176binary data.
177
178
179PLEASE NOTE: As PGPLOT is a Fortran library it expects it's images to be
180be stored in row order. Thus a 1D list is interpreted as a sequence of
181rows end to end. Perl is similar to C in that 2D arrays are arrays of
182pointers thus images end up stored in column order.
183
184Thus using perl multidimensional arrays the coordinate ($i,$j) should be
185stored in $img[$j][$i] for things to work as expected, e.g:
186
187 $img = [];
188 for $j (0..$nx-1) for $i (0..$ny-1) {
189 $$img[$j][$i] = whatever();
190 }}
191 pggray($$img, $nx, $ny, ...);
192
193Also PGPLOT displays coordinate (0,0) at the bottom left (this is
194natural as the subroutine library was written by an astronomer!).
195
196
197=back
198
199=head2 ARGUMENT MAPPING - FUNCTION NAMES
200
201Some PGPLOT functions (e.g. C<pgfunx>) take functions as callback
202arguments. In Perl simply pass a subroutine reference or a name,
203e.g.:
204
205 # Anonymous code reference:
206
207 pgfunx(sub{ sqrt($_[0]) }, 500, 0, 10, 0);
208
209 # Pass by ref:
210
211 sub foo {
212 my $x=shift;
213 return sin(4*$x);
214 }
215
216 pgfuny(\&foo, 360, 0, 2*$pi, 0);
217
218 # Pass by name:
219
220 pgfuny("foo", 360, 0, 2*$pi, 0);
221
222
223=head2 ARGUMENT MAPPING - GENERAL HANDLING OF BINARY DATA
224
225In addition to the implicit rules mentioned above PGPLOT now provides
226a scheme for explictly handling binary data in all routines.
227
228If your scalar variable (e.g. C<$x>) holds binary data (i.e. 'packed')
229then simply pass PGPLOT a reference to it (e.g. C<\$x>). Thus one can
230say:
231
232 read(MYDATA, $wavelens, $n*4);
233 read(MYDATA, $spectrum, $n*4);
234 pgline($n, \$wavelens, \$spectrum);
235
236This is very efficient as we can be sure the data never gets copied
237and will always be interpreted as binary.
238
239Again see the C<PDL> module for sophisticated manipulation of
240binary data. C<PDL> takes great advantage of these facilities.
241
242Be VERY careful binary data is of the right size or your segments
243might get violated.
244
# spent 336µs within PGPLOT::bootstrap which was called # once (336µs+0) by DynaLoader::bootstrap at line 226 of /opt/wise/lib/perl5/5.10.0/x86_64-linux-thread-multi/DynaLoader.pm
sub PGPLOT::bootstrap; # xsub
# spent 39.7ms within PGPLOT::pgbeg which was called # once (39.7ms+0) by WISE::PgAitoff::make_aitoff at line 211 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgbeg; # xsub
# spent 18.5ms within PGPLOT::pgdraw which was called 698 times, avg 26µs/call: # 698 times (18.5ms+0) by WISE::PgAitoff::versplot at line 1072 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 26µs/call
sub PGPLOT::pgdraw; # xsub
# spent 318µs within PGPLOT::pgmove which was called 51 times, avg 6µs/call: # 51 times (318µs+0) by WISE::PgAitoff::versplot at line 1071 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 6µs/call
sub PGPLOT::pgmove; # xsub
# spent 1.65ms within PGPLOT::pgpap which was called # once (1.65ms+0) by WISE::PgAitoff::make_aitoff at line 215 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgpap; # xsub
# spent 9.74ms within PGPLOT::pgpt which was called 20 times, avg 487µs/call: # 10 times (9.47ms+0) by WISE::PgAitoff::make_aitoff at line 331 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 947µs/call # 10 times (265µs+0) by WISE::PgAitoff::color_key at line 586 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 26µs/call
sub PGPLOT::pgpt; # xsub
# spent 20.4ms within PGPLOT::pgptext which was called 33 times, avg 619µs/call: # 19 times (790µs+0) by WISE::PgAitoff::number at line 1063 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 42µs/call # 10 times (355µs+0) by WISE::PgAitoff::color_key at line 589 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 36µs/call # once (19.1ms+0) by WISE::PgAitoff::color_key at line 562 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (74µs+0) by WISE::PgAitoff::label_aitoff at line 940 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (70µs+0) by WISE::PgAitoff::label_aitoff at line 938 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (67µs+0) by WISE::PgAitoff::label_aitoff at line 939 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgptext; # xsub
# spent 14µs within PGPLOT::pgqcs which was called # once (14µs+0) by WISE::PgAitoff::color_key at line 548 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgqcs; # xsub
# spent 76µs within PGPLOT::pgqtxt which was called 2 times, avg 38µs/call: # once (44µs+0) by WISE::PgAitoff::make_aitoff at line 252 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (32µs+0) by WISE::PgAitoff::label_aitoff at line 935 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgqtxt; # xsub
# spent 12µs within PGPLOT::pgqvp which was called # once (12µs+0) by WISE::PgAitoff::color_key at line 542 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgqvp; # xsub
# spent 23µs within PGPLOT::pgqwin which was called 2 times, avg 12µs/call: # once (13µs+0) by WISE::PgAitoff::color_key at line 544 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (10µs+0) by WISE::PgAitoff::label_aitoff at line 925 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgqwin; # xsub
# spent 112µs within PGPLOT::pgsch which was called 25 times, avg 4µs/call: # 10 times (35µs+0) by WISE::PgAitoff::color_key at line 585 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 3µs/call # 10 times (29µs+0) by WISE::PgAitoff::color_key at line 588 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 3µs/call # once (15µs+0) by WISE::PgAitoff::make_aitoff at line 251 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (14µs+0) by WISE::PgAitoff::make_aitoff at line 308 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (9µs+0) by WISE::PgAitoff::label_aitoff at line 931 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (5µs+0) by WISE::PgAitoff::color_key at line 546 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (5µs+0) by WISE::PgAitoff::color_key at line 561 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgsch; # xsub
# spent 168µs within PGPLOT::pgsci which was called 32 times, avg 5µs/call: # 10 times (54µs+0) by WISE::PgAitoff::make_aitoff at line 321 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 5µs/call # 10 times (45µs+0) by WISE::PgAitoff::color_key at line 584 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 4µs/call # 10 times (43µs+0) by WISE::PgAitoff::color_key at line 587 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 4µs/call # once (15µs+0) by WISE::PgAitoff::label_aitoff at line 930 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (11µs+0) by WISE::PgAitoff::color_key at line 560 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgsci; # xsub
# spent 19µs within PGPLOT::pgsclp which was called 2 times, avg 10µs/call: # once (11µs+0) by WISE::PgAitoff::color_key at line 556 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (8µs+0) by WISE::PgAitoff::color_key at line 593 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgsclp; # xsub
# spent 99.7ms within PGPLOT::pgscr which was called 18 times, avg 5.54ms/call: # 16 times (77µs+0) by WISE::PgAitoff::make_aitoff at line 238 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm, avg 5µs/call # once (97.7ms+0) by WISE::PgAitoff::make_aitoff at line 230 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (1.93ms+0) by WISE::PgAitoff::make_aitoff at line 231 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgscr; # xsub
# spent 39µs within PGPLOT::pgstbg which was called 2 times, avg 20µs/call: # once (34µs+0) by WISE::PgAitoff::make_aitoff at line 311 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm # once (5µs+0) by WISE::PgAitoff::label_aitoff at line 932 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgstbg; # xsub
# spent 19µs within PGPLOT::pgsvp which was called # once (19µs+0) by WISE::PgAitoff::make_aitoff at line 244 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgsvp; # xsub
# spent 24µs within PGPLOT::pgswin which was called # once (24µs+0) by WISE::PgAitoff::make_aitoff at line 247 of /wise/base/deliv/dev/lib/perl/WISE/PgAitoff.pm
sub PGPLOT::pgswin; # xsub