1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2008 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 <lttv/tracecontext.h>
28 #include <lttv/traceset.h>
32 #define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
36 #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
44 struct _Packet
* packet
;
52 uint32_t saddr
, daddr
;
53 uint16_t source
, dest
;
56 typedef struct _Packet
58 ConnectionKey connKey
;
59 unsigned int tot_len
, ihl
, seq
, ack_seq
, doff
, ack
, rst
, syn
, fin
;
60 NetEvent
* inE
, * outE
;
67 // notation: s__: sum of __; __2: __ squared; example sd2: sum of d squared
68 double st
, st2
, sd
, sd2
, std
, x
, d0
, e
;
74 unsigned int* previousVertex
;
75 unsigned int reference
;
80 int totRecv
, totRecvIp
, totInE
, totOutE
, totPacket
, totExchangeEffective
,
82 int totPacketNeedAck
, totPacketCummAcked
;
87 LttvTracesetContext
* tsc
;
90 // unsigned int traceNumTable[trace*]
91 GHashTable
* traceNumTable
;
93 // hookListList conceptually is a two dimensionnal array of LttvTraceHook
94 // elements. It uses GArrays to interface with other lttv functions that
98 // inE* pendingRecv[trace]
99 GHashTable
* pendingRecv
;
100 // inE* unMatchedInE[packet]
101 GHashTable
* unMatchedInE
;
102 // outE* unMatchedOutE[packet]
103 GHashTable
* unMatchedOutE
;
104 // packet* unAcked[connKey]
116 LttvTraceHook
* traceHook
;
117 SyncState
* syncState
;
122 static void destroy();
124 void sync_traceset(LttvTracesetContext
* const tsc
);
126 void registerHooks(SyncState
* const syncState
);
127 void unregisterHooks(SyncState
* const syncState
);
128 void finalizeLSA(SyncState
* const syncState
);
129 void doGraphProcessing(SyncState
* const syncState
);
130 void calculateFactors(SyncState
* const syncState
);
132 static gboolean
process_event_by_id(void* hook_data
, void* call_data
);
134 static void matchEvents(NetEvent
* const netEvent
, GHashTable
* const unMatchedList
,
135 GHashTable
* const unMatchedOppositeList
, LttEvent
* const event
,
136 LttvTraceHook
* const trace_hook
, const size_t fieldOffset
);
138 static bool isAck(const Packet
* const packet
);
139 static bool isAcking(const Packet
* const ackPacket
, const Packet
* const
141 static bool needsAck(const Packet
* const packet
);
143 static bool connectionKeyEqual(const ConnectionKey
* const a
, const
144 ConnectionKey
* const b
);
146 static void netEventListDestroy(gpointer data
);
147 static void netEventRemove(gpointer data
, gpointer user_data
);
149 static guint
netEventPacketHash(gconstpointer key
);
150 static gboolean
netEventPacketEqual(gconstpointer a
, gconstpointer b
);
151 static void ghtDestroyNetEvent(gpointer data
);
153 static void packetListDestroy(gpointer data
);
154 static void packetRemove(gpointer data
, gpointer user_data
);
156 static void destroyPacket(Packet
* const packet
);
157 static void destroyNetEvent(NetEvent
* const event
);
159 static void graphRemove(gpointer data
, gpointer user_data
);
161 static gint
netEventSkbCompare(gconstpointer a
, gconstpointer b
);
162 static gint
netEventPacketCompare(gconstpointer a
, gconstpointer b
);
163 static gint
packetAckCompare(gconstpointer a
, gconstpointer b
);
164 static gint
graphTraceCompare(gconstpointer a
, gconstpointer b
);
166 static guint
connectionHash(gconstpointer key
);
167 static gboolean
connectionEqual(gconstpointer a
, gconstpointer b
);
168 static void connectionDestroy(gpointer data
);
170 static void convertIP(char* const str
, const uint32_t addr
);
171 static void printPacket(const Packet
* const packet
);
173 static void shortestPath(Fit
* const* const fitArray
, const unsigned int
174 traceNum
, const unsigned int traceNb
, double* const distances
, unsigned
175 int* const previousVertex
);
176 static double sumDistances(const double* const distances
, const unsigned int traceNb
);
177 static void factors(Fit
* const* const fitArray
, const unsigned int* const
178 previousVertex
, const unsigned int traceNum
, double* const drift
, double*
179 const offset
, double* const stDev
);
181 static void timeDiff(struct timeval
* const end
, const struct timeval
* const start
);
This page took 0.034308 seconds and 5 git commands to generate.