summaryrefslogtreecommitdiffstats
path: root/trace.c
diff options
context:
space:
mode:
authorAndreas Eversberg2010-01-16 11:20:23 +0100
committerAndreas Eversberg2010-01-16 11:20:23 +0100
commitb0bd74e35e935aa976b68c594def4e8d2c22ef95 (patch)
tree7e7033beb3b9b1a1976d58ce4e16c6f965a3c9fc /trace.c
parentAdded new option to interface.conf: "nonotify" to disable notify messages. (diff)
downloadlcr-b0bd74e35e935aa976b68c594def4e8d2c22ef95.tar.gz
lcr-b0bd74e35e935aa976b68c594def4e8d2c22ef95.tar.xz
lcr-b0bd74e35e935aa976b68c594def4e8d2c22ef95.zip
Replaced polling loop for LCR and chan_lcr with select based event loop.
Now LCR and chan_lcr will not use any CPU until there is work to do.
Diffstat (limited to 'trace.c')
-rw-r--r--trace.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/trace.c b/trace.c
index 73686ff..b8dc001 100644
--- a/trace.c
+++ b/trace.c
@@ -22,6 +22,8 @@ static const char *spaces = " ";
*/
void _start_trace(const char *__file, int __line, int port, struct interface *interface, const char *caller, const char *dialing, int direction, int category, int serial, const char *name)
{
+ struct timeval current_time;
+
if (trace.name[0])
PERROR("trace already started (name=%s) in file %s line %d\n", trace.name, __file, __line);
memset(&trace, 0, sizeof(struct trace));
@@ -39,8 +41,9 @@ void _start_trace(const char *__file, int __line, int port, struct interface *in
SCPY(trace.name, name);
if (!trace.name[0])
SCPY(trace.name, "<unknown>");
- trace.sec = now_tv.tv_sec;
- trace.usec = now_tv.tv_usec;
+ gettimeofday(&current_time, NULL);
+ trace.sec = current_time.tv_sec;
+ trace.usec = current_time.tv_usec;
}
@@ -270,7 +273,7 @@ void _end_trace(const char *__file, int __line)
if (string) {
/* process debug */
if (options.deb)
- debug(NULL, 0, "trace", string);
+ debug(NULL, 0, "TRACE", string);
/* process log */
if (options.log[0]) {
fp = fopen(options.log, "a");