summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pdfetexdir/extratime.ch
blob: d417ab25e29169058350ae5eb10730e0066a5cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
%
% extratime.ch -- benchmarking support
%
% (c) 2005 Taco Hoekwater, taco@elvenkind.com
%
% This change file implements an interface to the precise system 
% time (if available) as an aid in benchmarking TeX macro code. 
%
% Two new primitives are provided:
%
% \item |\elapsedtime| is a read-only integer that (initially)
% returns the amount of time passed since the start of this run.
% This amount is given in `scaled seconds': the value 65536 
% counts as one second.
% If more time has passed than 32767 seconds, |\maxint| will be
% returned.
%
% \item |\resettime| updates the internal timer, such that
% subsequent calls to |\elapsedtime| will restart from 0.
%
% Besides this web change file,
% there is also a new C function needed in |texmfmp.{c,h}|, and a 
% new definition in |texmf.defines| to keep |convert| happy.

% This change file is intended to be used as the last one in 
% pdfetex's |tie| chains, a patch for |Makefile.in| is included.
% 
%

@x
@ The integer parameters should really be initialized by a macro package;
@y
@ @<Glob...@>=
@!epochseconds: integer;
@!microseconds: integer;

@ 
@p function get_microinterval:integer;
var s,@!m:integer; {seconds and microseconds}
begin
   seconds_and_micros(s,m);
   if (s-epochseconds)>32767 then
     get_microinterval := max_integer
   else if (microseconds<m)  then
     get_microinterval := ((s-1-epochseconds)*65536)+ (((m+1000000-microseconds)/100)*65536)/10000
   else
     get_microinterval := ((s-epochseconds)*65536)  + (((m-microseconds)/100)*65536)/10000;
end;

@ The integer parameters should really be initialized by a macro package;
@z

@x
@d badness_code=input_line_no_code+1 {code for \.{\\badness}}
@y
@d elapsed_time_code=input_line_no_code+1 {code for \.{\\elapsedtime}}
@d badness_code=input_line_no_code+2 {code for \.{\\badness}}
@z

@x l.9016
primitive("badness",last_item,badness_code);
@!@:badness_}{\.{\\badness} primitive@>
@y
primitive("badness",last_item,badness_code);
@!@:badness_}{\.{\\badness} primitive@>
primitive("elapsedtime",last_item,elapsed_time_code);
@!@:elapsed_time_}{\.{\\elapsedtime} primitive@>
@z

@x l.30672
@d pdftex_last_extension_code  == pdftex_first_extension_code + 24
@y
@d reset_timer_code == pdftex_first_extension_code + 25
@d pdftex_last_extension_code  == pdftex_first_extension_code + 25
@z


@x l.30735
primitive("pdftrailer",extension,pdf_trailer_code);@/
@!@:pdf_trailer_}{\.{\\pdftrailer} primitive@>
@y
primitive("pdftrailer",extension,pdf_trailer_code);@/
@!@:pdf_trailer_}{\.{\\pdftrailer} primitive@>
primitive("resettimer",extension,reset_timer_code);@/
@!@:reset_timer_}{\.{\\resettimer} primitive@>
@z


@x l.30776
  pdf_trailer_code: print_esc("pdftrailer");
@y
  pdf_trailer_code: print_esc("pdftrailer");
  reset_timer_code: print_esc("resettimer");
@z

@x l.30822
pdf_trailer_code: @<Implement \.{\\pdftrailer}@>;
@y
pdf_trailer_code: @<Implement \.{\\pdftrailer}@>;
reset_timer_code: @<Implement \.{\\resettimer}@>;
@z


@x l.31776
@ @<Implement \.{\\pdftrailer}@>=
@y
@ @<Set initial values of key variables@>=
  seconds_and_micros(epochseconds,microseconds);

@ @<Implement \.{\\resettimer}@>=
begin
  seconds_and_micros(epochseconds,microseconds);
end

@ @<Implement \.{\\pdftrailer}@>=
@z

@x l.33134
last_node_type_code: print_esc("lastnodetype");
@y
last_node_type_code: print_esc("lastnodetype");
elapsed_time_code: print_esc("elapsedtime");
@z

@x l.33124
eTeX_version_code: cur_val:=eTeX_version;
@y
eTeX_version_code: cur_val:=eTeX_version;
elapsed_time_code: cur_val:=get_microinterval;
@z