/* 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 EVENT_ANALYSIS_CHULL_H
#include <glib.h>
-#include "data_structures_tcp.h"
+#include "data_structures.h"
+#ifdef HAVE_LIBGLPK
+#include <glpk.h>
+#endif
typedef struct
{
- LttCycleCount x, y;
+ uint64_t x, y;
} Point;
-typedef enum
-{
- /* Used for identity factors (a0= 0, a1= 1) that map a trace to itself. In
- * this case, min, max and accuracy are not initialized.
- */
- EXACT,
- /* The approximation is the middle of the min and max limits, all fields
- * are initialized.
- */
- MIDDLE,
- /* min and max are not available because the hulls do not respect
- * assumptions (hulls should not intersect and the upper half-hull should
- * be below the lower half-hull). The approximation is a "best effort".
- * All fields are initialized but min and max are NULL.
- */
- FALLBACK,
- /* min or max is available but not both. The hulls respected assumptions
- * but all receives took place after all sends or vice versa. approx and
- * accuracy are not initialized.
- */
- INCOMPLETE,
- /* The pair of trace did not have communications in both directions (maybe
- * even no communication at all). approx and accuracy are not initialized.
- */
- ABSENT,
- /* min and max are not available because the algorithms are screwed. One
- * of min or max (but not both) is NULL. The other is initialized. Approx
- * is not initialized.
- */
- SCREWED,
-} ApproxType;
-
-
-typedef struct
-{
- Factors* min, * max, * approx;
- ApproxType type;
- double accuracy;
-} FactorsCHull;
-
-
typedef struct
{
unsigned int dropped;
- /* FactorsCHull allFactors[traceNb][traceNb]
- *
- * allFactors is divided into three parts depending on the position of an
- * element allFactors[i][j]:
+ /* geoFactors is divided into three parts depending on the position of an
+ * element geoFactors->pairFactors[i][j]:
* Lower triangular part of the matrix
* i > j
* This contains the factors between nodes i and j. These factors
* This contains identity factors (a0= 0, a1= 1).
* Upper triangular part of the matrix
* i < j
- * This area is not allocated.
+ * These factors are absent
+ *
+ * Factor types are used as follows:
+ * EXACT,
+ * Used for identity factors (a0= 0, a1= 1) that map a trace to itself. In
+ * this case, min, max and accuracy are not initialized.
+ *
+ * ACCURATE,
+ * The approximation is the middle of the min and max limits.
+ *
+ * APPROXIMATE,
+ * min and max are not available because the hulls do not respect
+ * assumptions (hulls should not intersect and the upper half-hull should
+ * be below the lower half-hull). The approximation is a "best effort".
+ * All fields are initialized but min and max are NULL.
+ *
+ * INCOMPLETE,
+ * min or max is available but not both. The hulls respected assumptions
+ * but all receives took place after all sends or vice versa.
+ *
+ * ABSENT,
+ * The pair of trace did not have communications in both directions (maybe
+ * even no communication at all). Also used for factors in the upper
+ * triangular matrix.
+ *
+ * FAIL,
+ * min and max are not available because the algorithms are defective. One
+ * of min or max (but not both) is NULL. The other is initialized.
*/
- FactorsCHull** allFactors;
+ AllFactors* geoFactors;
+
+#ifdef HAVE_LIBGLPK
+ /* Synchronization factors, as calculated via LP, for comparison. Same
+ * structure as geoFactors.
+ *
+ * Factor types are used as follows:
+ * EXACT,
+ * Used for identity factors (a0= 0, a1= 1) that map a trace to itself. In
+ * this case, min, max and accuracy are not initialized.
+ *
+ * ACCURATE,
+ * The approximation is the middle of the min and max limits.
+ *
+ * INCOMPLETE,
+ * min or max is available but not both. The hulls respected assumptions
+ * but all receives took place after all sends or vice versa.
+ *
+ * ABSENT,
+ * The pair of trace did not have communications in both directions (maybe
+ * even no communication at all). Also used when the hulls do not respect
+ * assumptions. Also used for factors in the upper triangular matrix.
+ */
+ AllFactors* lpFactors;
+#endif
+
+ /* This is AnalysisStatsCHull.lpFactors if it is available or else
+ * AnalysisStatsCHull.geoFactors.
+ */
+ AllFactors* allFactors;
} AnalysisStatsCHull;
*/
FILE*** hullPoints;
- /* FactorsCHull allFactors[traceNb][traceNb]
- * This is the same array as AnalysisStatsCHull.allFactors.
+ /* This is AnalysisStatsCHull.lpFactors if it is available or else
+ * AnalysisStatsCHull.geoFactors.
+ */
+ AllFactors* allFactors;
+
+#ifdef HAVE_LIBGLPK
+ /* This is the same array as AnalysisStatsCHull.lpFactors.
*/
- FactorsCHull** allFactors;
+ AllFactors* lpFactors;
+#endif
} AnalysisGraphsDataCHull;
typedef struct
{
- /* Point hullArray[traceNb][traceNb][]
+ /* Point* hullArray[traceNb][traceNb][]
*
* A message comes from two traces. The lowest numbered trace is
* considered to be the reference clock, CA. The other is CB. The
*/
GQueue*** hullArray;
+#ifdef HAVE_LIBGLPK
+ /* glp_prob* lps[traceNum][traceNum]
+ *
+ * Only the lower triangular part of the matrix is allocated, that is
+ * lps[i][j] where i > j */
+ glp_prob*** lps;
+#endif
+
AnalysisStatsCHull* stats;
AnalysisGraphsDataCHull* graphsData;
} AnalysisDataCHull;
+void registerAnalysisCHull();
+
#endif