/* This file is part of the Linux Trace Toolkit viewer
- * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca>
+ * Copyright (C) 2009, 2010 Benjamin Poirier <benjamin.poirier@polymtl.ca>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License Version 2 as
- * published by the Free Software Foundation;
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 2.1 of the License, or (at
+ * your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATA_STRUCTURES_H
#include <stdbool.h>
#include <stdint.h>
-#include <ltt/ltt.h>
-
enum Direction
{
bool unicast;
} UDPEvent;
+typedef struct
+{
+ uint32_t seconds;
+ uint32_t nanosec;
+} WallTime;
+
typedef struct _Event
{
unsigned long traceNum;
- uint64_t time;
+ // wallTime is corrected according to factors in trace struct, cpuTime
+ // is not
+ uint64_t cpuTime;
+ WallTime wallTime;
// specific event structures and functions could be in separate files and
// type could be an int
UDPEvent* udpEvent;
} event;
+ void (*copy)(const struct _Event* const event, struct _Event** const newEvent);
void (*destroy)(struct _Event* const event);
} Event;
typedef struct
{
Message* message;
+ // Event* acks[]
GQueue* acks;
} Exchange;
typedef struct
{
+ // Event* events[]
GQueue* events;
} Broadcast;
// Event-related functions
void gdnDestroyEvent(gpointer data);
+void copyEvent(const Event* const event, Event** const newEvent);
+void copyTCPEvent(const Event* const event, Event** const newEvent);
+void copyUDPEvent(const Event* const event, Event** const newEvent);
void destroyEvent(Event* const event);
void destroyTCPEvent(Event* const event);
void destroyUDPEvent(Event* const event);
void gfDestroyEvent(gpointer data, gpointer user_data);
+double wallTimeSub(const WallTime const* tA, const WallTime const* tB);
+void gfAddEventToArray(gpointer data, gpointer user_data);
// Message-related functions
void printTCPSegment(const Message* const segment);