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.
23 #include "timestamps.h"
31 static jack_timestamp_t
*timestamps
= 0;
32 static unsigned long timestamp_cnt
= 0;
33 static unsigned long timestamp_index
;
36 jack_init_timestamps (unsigned long howmany
)
41 timestamps
= (jack_timestamp_t
*)
42 malloc (howmany
* sizeof(jack_timestamp_t
));
43 timestamp_cnt
= howmany
;
44 memset (timestamps
, 0, sizeof(jack_timestamp_t
) * howmany
);
49 jack_timestamp (const char *what
)
51 if (timestamp_index
< timestamp_cnt
) {
52 timestamps
[timestamp_index
].when
= GetMicroSeconds();
53 timestamps
[timestamp_index
].what
= what
;
59 jack_dump_timestamps (FILE *out
)
63 for (i
= 0; i
< timestamp_index
; ++i
) {
64 fprintf (out
, "%-.32s %" PRIu64
" %" PRIu64
,
65 timestamps
[i
].what
, timestamps
[i
].when
,
66 timestamps
[i
].when
- timestamps
[0].when
);
68 fprintf (out
, " %" PRIu64
,
69 timestamps
[i
].when
- timestamps
[i
-1].when
);
76 jack_reset_timestamps ()