1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 #include "sync_chain.h"
30 GQueue processingModules
= G_QUEUE_INIT
;
31 GQueue matchingModules
= G_QUEUE_INIT
;
32 GQueue analysisModules
= G_QUEUE_INIT
;
33 GQueue moduleOptions
= G_QUEUE_INIT
;
37 * Calculate the elapsed time between two timeval values
40 * end: end time, result is also stored in this structure
43 void timeDiff(struct timeval
* const end
, const struct timeval
* const start
)
45 if (end
->tv_usec
>= start
->tv_usec
)
47 end
->tv_sec
-= start
->tv_sec
;
48 end
->tv_usec
-= start
->tv_usec
;
52 end
->tv_sec
= end
->tv_sec
- start
->tv_sec
- 1;
53 end
->tv_usec
= end
->tv_usec
- start
->tv_usec
+ 1e6
;
59 * A GCompareFunc for g_slist_find_custom()
62 * a: ProcessingModule*, element's data
63 * b: char*, user data to compare against
66 * 0 if the processing module a's name is b
68 gint
gcfCompareProcessing(gconstpointer a
, gconstpointer b
)
70 const ProcessingModule
* processingModule
;
73 processingModule
= (const ProcessingModule
*) a
;
74 name
= (const char*) b
;
76 return strncmp(processingModule
->name
, name
,
77 strlen(processingModule
->name
) + 1);
82 * A GCompareFunc for g_slist_find_custom()
85 * a: MatchingModule*, element's data
86 * b: char*, user data to compare against
89 * 0 if the matching module a's name is b
91 gint
gcfCompareMatching(gconstpointer a
, gconstpointer b
)
93 const MatchingModule
* matchingModule
;
96 matchingModule
= (const MatchingModule
*) a
;
97 name
= (const char*) b
;
99 return strncmp(matchingModule
->name
, name
, strlen(matchingModule
->name
) +
105 * A GCompareFunc for g_slist_find_custom()
108 * a: AnalysisModule*, element's data
109 * b: char*, user data to compare against
112 * 0 if the analysis module a's name is b
114 gint
gcfCompareAnalysis(gconstpointer a
, gconstpointer b
)
116 const AnalysisModule
* analysisModule
;
119 analysisModule
= (const AnalysisModule
*) a
;
120 name
= (const char*) b
;
122 return strncmp(analysisModule
->name
, name
, strlen(analysisModule
->name
) +
This page took 0.036117 seconds and 5 git commands to generate.