| 1 |
lars |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
|
|
2 |
<HTML>
|
|
|
3 |
<HEAD>
|
|
|
4 |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
|
|
|
5 |
<LINK REL="Start" HREF="index.html">
|
|
|
6 |
<LINK REL="Contents" HREF="toc.html">
|
|
|
7 |
<LINK REL="Prev" HREF="1020Adjustingbrightnessandcontrastforimagesandbackgrounds.html">
|
|
|
8 |
<LINK REL="Next" HREF="1022Usingcountryflagsinvariouscontext.html">
|
|
|
9 |
<STYLE TYPE="text/css"><!--
|
|
|
10 |
BODY { font-family: serif }
|
|
|
11 |
H1 { font-family: sans-serif }
|
|
|
12 |
H2 { font-family: sans-serif }
|
|
|
13 |
H3 { font-family: sans-serif }
|
|
|
14 |
H4 { font-family: sans-serif }
|
|
|
15 |
H5 { font-family: sans-serif }
|
|
|
16 |
H6 { font-family: sans-serif }
|
|
|
17 |
SUB { font-size: smaller }
|
|
|
18 |
SUP { font-size: smaller }
|
|
|
19 |
PRE { font-family: monospace }
|
|
|
20 |
A { text-decoration: none }
|
|
|
21 |
--></STYLE>
|
|
|
22 |
</HEAD>
|
|
|
23 |
<BODY>
|
|
|
24 |
<A HREF="toc.html">Contents</A>
|
|
|
25 |
<A HREF="1020Adjustingbrightnessandcontrastforimagesandbackgrounds.html">Previous</A>
|
|
|
26 |
<A HREF="1022Usingcountryflagsinvariouscontext.html">Next</A>
|
|
|
27 |
<HR NOSHADE>
|
|
|
28 |
<H2><A NAME="10_21">10.21 Timing the generation of graphs</A></H2>
|
|
|
29 |
<P> During development and optimization it can be very handy to have the
|
|
|
30 |
actual time it took to generate the image as a footnote. The following
|
|
|
31 |
example shows the usage of this feature<DIV class="example">
|
|
|
32 |
<BR> <A href="exframes/frame_example11.html" target="blank"><IMG border="0"
|
|
|
33 |
HEIGHT="200" src="img/example11.png" WIDTH="300"></A>
|
|
|
34 |
<BR><B>Figure 178:</B> Timing of a graph <A href="exframes/frame_example11.html"
|
|
|
35 |
target="blank">[src]</A>
|
|
|
36 |
<P></P>
|
|
|
37 |
</DIV></P>
|
|
|
38 |
<P> To enable this feature you can proceed in two ways.</P>
|
|
|
39 |
<OL>
|
|
|
40 |
<LI> You can either set the global define BRAND_TIMING (in jpgraph.php)
|
|
|
41 |
to true. This will add the timing string to all graphs generated.</LI>
|
|
|
42 |
<LI> .. or you can enable it for a specific graph by setting the global
|
|
|
43 |
variable $gJpgBrandTiming as in<DIV class="phpscript"><CODE><FONT color="#000000">
|
|
|
44 |
<FONT color="#0000BB"> $gJpgBrandTiming</FONT><FONT color="#007700">=</FONT><FONT
|
|
|
45 |
color="#0000BB">true</FONT><FONT color="#007700">;</FONT><FONT color="#0000BB">
|
|
|
46 |
</FONT></FONT></CODE></DIV>
|
|
|
47 |
<P>in the beginning of the script.</P>
|
|
|
48 |
</LI>
|
|
|
49 |
</OL>
|
|
|
50 |
<P> If you like you might also change the way the timing is formatted by
|
|
|
51 |
setting the string defined by BRAND_TIMING_FORMAT (in jpgraph.php).
|
|
|
52 |
This string represents a standard printf() format string.<DIV class="note">
|
|
|
53 |
<B>Note:</B> JpGraph contains a utility class called JpgTimer which you
|
|
|
54 |
can use yourself should you need ms timing of part of your own code.
|
|
|
55 |
The API is really simple. The class supports multiple running timers
|
|
|
56 |
and you start a timer simply by calling the Push() method. This will
|
|
|
57 |
start a new timer and put it on the top of the timer stack. To stop the
|
|
|
58 |
timer, pop it from the stack and return the timing value simply call
|
|
|
59 |
Pop().</DIV></P>
|
|
|
60 |
<HR NOSHADE>
|
|
|
61 |
<A HREF="toc.html">Contents</A>
|
|
|
62 |
<A HREF="1020Adjustingbrightnessandcontrastforimagesandbackgrounds.html">Previous</A>
|
|
|
63 |
<A HREF="1022Usingcountryflagsinvariouscontext.html">Next</A>
|
|
|
64 |
</BODY>
|
|
|
65 |
</HTML>
|