2 Copyright (C) 2002-2003 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "timestamps.h"
30 static jack_timestamp_t
*timestamps
= 0;
31 static unsigned long timestamp_cnt
= 0;
32 static unsigned long timestamp_index
;
35 jack_init_timestamps (unsigned long howmany
)
40 timestamps
= (jack_timestamp_t
*)
41 malloc (howmany
* sizeof(jack_timestamp_t
));
42 timestamp_cnt
= howmany
;
43 memset (timestamps
, 0, sizeof(jack_timestamp_t
) * howmany
);
48 jack_timestamp (const char *what
)
50 if (timestamp_index
< timestamp_cnt
) {
51 timestamps
[timestamp_index
].when
= GetMicroSeconds();
52 timestamps
[timestamp_index
].what
= what
;
58 jack_dump_timestamps (FILE *out
)
62 for (i
= 0; i
< timestamp_index
; ++i
) {
63 fprintf (out
, "%-.32s %" PRIu64
" %" PRIu64
,
64 timestamps
[i
].what
, timestamps
[i
].when
,
65 timestamps
[i
].when
- timestamps
[0].when
);
67 fprintf (out
, " %" PRIu64
,
68 timestamps
[i
].when
- timestamps
[i
-1].when
);
75 jack_reset_timestamps ()