** Warning: Cannot open xref database.
1 /*
2 Copyright (C) 2002-2003 Paul Davis
3
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.
8
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.
13
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.
17
18 $Id: timestamps.c,v 1.6 2003/08/27 16:26:23 joq Exp $
19 */
20
21 #include <stdlib.h>
22 #include <string.h>
23 #include <jack/timestamps.h>
24 #include <jack/internal.h>
25 #include <jack/time.h>
26
27 typedef struct {
28 jack_time_t when;
29 const char *what;
30 } jack_timestamp_t;
31
32 static jack_timestamp_t *timestamps = 0;
33 static unsigned long timestamp_cnt = 0;
34 static unsigned long timestamp_index;
35
36 void
37 jack_init_timestamps (unsigned long howmany)
38 {
39 if (timestamps) {
40 free (timestamps);
41 }
42 timestamps = (jack_timestamp_t *)
43 malloc (howmany * sizeof(jack_timestamp_t));
44 timestamp_cnt = howmany;
45 memset (timestamps, 0, sizeof (jack_timestamp_t) * howmany);
46 timestamp_index = 0;
47 }
48
49 void
50 jack_timestamp (const char *what)
51 {
52 if (timestamp_index < timestamp_cnt) {
53 timestamps[timestamp_index].when = jack_get_microseconds();
54 timestamps[timestamp_index].what = what;
55 ++timestamp_index;
56 }
57 }
58
59 void
60 jack_dump_timestamps (FILE *out)
61 {
62 unsigned long i;
63
64 for (i = 0; i < timestamp_index; ++i) {
65 fprintf (out, "%-.32s %" PRIu64 " %" PRIu64,
66 timestamps[i].what, timestamps[i].when,
67 timestamps[i].when - timestamps[0].when);
68 if (i > 0) {
69 fprintf (out, " %" PRIu64,
70 timestamps[i].when - timestamps[i-1].when);
71 }
72 fputc ('\n', out);
73 }
74 }
75
76 void
77 jack_reset_timestamps ()
78 {
79 timestamp_index = 0;
80 }
81
82
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.