#CPPFLAGS="$CPPFLAGS -I"
+AM_CONDITIONAL(LTTVSTATIC, test "$enable_lttvstatic" = yes)
lttvlibdir="${libdir}/lttv"
AC_SUBST(lttvlibdir)
iattribute.c state.c stats.c \
tracecontext.c traceset.c
+if LTTVSTATIC
+ lttv_LDFLAGS = -profile -static
+endif
static int
a_sample_interval,
a_sample_number,
+ a_seek_number,
a_save_interval;
static gboolean
if((a_test7 && a_test3) || a_test_all) {
int i, j;
- for(i = 0 ; i < 2 ; i++) {
+ for(i = 0 ; i < a_seek_number ; i++) {
for(j = save_state.position - 1 ; j >= 0 ; j--) {
lttv_state_add_event_hooks(ts);
t = run_one_test(ts, save_state.write_time[j],
"maximum number",
LTTV_OPT_INT, &a_sample_number, NULL, NULL);
+ a_seek_number = 200;
+ lttv_option_add("seek-number", 'K',
+ "Number of seek",
+ "number",
+ LTTV_OPT_INT, &a_seek_number, NULL, NULL);
+
a_test1 = FALSE;
lttv_option_add("test1", '1', "Test just counting events", "",
LTTV_OPT_NONE, &a_test1, NULL, NULL);
lttv_option_remove("save-state-copy");
lttv_option_remove("sample-interval");
lttv_option_remove("sample-number");
+ lttv_option_remove("seek-number");
lttv_option_remove("save-interval");
lttv_option_remove("test1");
lttv_option_remove("test2");
--- /dev/null
+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2003-2004 Michel Dagenais
+ *
+ * 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 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.
+ *
+ * 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.
+ */
+
+
+/* This file does not even compile yet. It is a starting point to compute
+ some values in the background. This is why process_trace was split in
+ three. However, process_trace_middle as it is currently is would not work.
+ It needs to reinitialize its trace event positions each time since,
+ in between background calls to process middle, other foreground calls to
+ process_middle can happen. */
+
+#include <lttvwindow/idleprocesstrace.h>
+
+/* The calling function has checked that the needed information has not
+ been or is not being computed yet, has prepared the trace, and now all
+ that is needed is to queue it for processing.
+
+ CHECK remove the work_queue global variable, have an automatic adjustment
+ of the number of events to process by iteration. */
+
+static gboolean inserted = false;
+
+static GList *work_queue = NULL;
+
+typedef struct _WorkPiece WorkPiece;
+
+struct _WorkPiece {
+ LttvTracesetContext *self;
+ LttTime end;
+ unsigned nb_events;
+ LttvHook f;
+ void *hook_data;
+ unsigned nb_done;
+}
+
+guint lttv_process_traceset_piece(gpointer data)
+{
+ GList *first = g_list_first(work_queue);
+
+ guint nb_done, nb_asked;
+
+ if(first == NULL) {
+ inserted = false;
+ return false;
+ }
+
+ WorkPiece *work_piece = (WorkPiece *)first->data;
+ nb_asked = work_piece->nb_events - work_piece->nb_done;
+ nb_asked = min(nb_asked, 10000);
+ nb_done = lttv_process_trace_middle(work_piece->self,work_piece->end,
+ nb_asked);
+ work_piece->nb_done += nb_done;
+ if(nb_done < nb_asked) {
+ lttv_process_trace_end(work_piece->self);
+ work_queue = g_list_delete(work_queue, first);
+ }
+}
+
+
+void lttv_process_traceset_when_idle(LttvTracesetContext *self, LttTime end,
+ unsigned nb_events, LttvHook f, void *hook_data)
+{
+ WorkPiece *work_piece = g_new(WorkPiece);
+ work_piece->self = self;
+ work_piece->end = end;
+ work_piece->nb_events = nb_events;
+ work_piece->f = f;
+ work_piece->hook_data = hook_data;
+ eork_piece->nb_done = 0;
+
+ lttv_process_traceset_begin(self);
+ work_queue = g_list_append(work_queue, work_piece);
+ if(!inserted) g_idle_add(lttv_process_traceset_piece, work_queue);
+}
+
+
*/
/*
-CHECK Rename to viewer.h
+This file is what every viewer plugin writer should refer to.
+
+- Rename to viewer.h
+- Remove the _api functions which add nothing
+- streamline the rest.
+
+A viewer plugin is, before anything, a plugin. It thus has an init and
+a destroy function called whenever it is loaded/initialized and
+unloaded/destroyed. A viewer depends on lttvwindow and thus uses its init and
+destroy functions to register viewer related hooks defined in this file.
+
+The lifetime of a viewer is as follows. The viewer constructor function is
+called each time an instance view is created (one subwindow of this viewer
+type is created by the user). Thereafter, the viewer gets hooks called for
+different purposes by the window containing it. These hooks are detailed
+below.
+
+show: called initially once the trace, position and time window are known.
+ Do the drawing or register hooks
+process_trace for show: hooks called
+show_end: remove the hooks
+
+background_init: prepare for background computation (comes after show_end).
+process_trace for background: done in small chunks in gtk_idle, hooks called.
+background_end: remove the hooks and perhaps update the window.
+
+update: called when the windows is exposed/resized, the time window is changed,
+ the current time is changed or the traceset is changed (different
+ traceset or traces added/removed. Redraw or register hooks.
+process_trace for update: hooks called
+update_end: remove the hooks.
+
+There may be different versions of update functions for the different cases,
+or the type of update may be described in an argument. The expose method
+normally provides the exposed region. This should be used to register hooks
+to process_traceset but also tell about the time interval for which it is
+required. Then, a expose_end will be required to remove the hooks and finish
+the display as needed.
+
+In most cases, the enclosing window knows about updates such as a new trace
+added to a traceset, time window updates caused by scrolling and even
+expose events. There are a few cases, however, where updates are caused by
+actions known by a view instance. For example, clicking in a view may update
+the current time; all viewers within the same window must be told about the
+new current time to change the currently highlighted time point. A viewer
+reports such events by calling report_update on its lttvwindow. The lttvwindow
+will thereafter call update for each of its contained viewers.
+
Things that can happen to a viewer:
update_filter
show_viewer
update_dividor
-?? Reshape, damage ??
+?? Reshape, damage as gtk methods ??
Things that a viewer can do:
--- /dev/null
+#! /bin/sh
+
+# Script to build three versions of ltt/lttv (optimized, optimized and profiled
+# and not optimized) and compare their performance for processing a trace.
+# The profiled version produces detailed per function timings.
+#
+# The script expects 2 arguments: the temporary directory where to install
+# the three versions and the directory containing the trace to process.
+
+v1=$1/ltt1
+v2=$1/ltt2
+v3=$1/ltt3
+tracedir=$2
+
+if [ -z "$1" -o -z "$tracedir" ]; then
+ echo "Usage: $0 tmpdir trace"
+ exit 1
+fi
+
+BuildTest () {
+ (make clean; ./autogen.sh --prefix=$1 --enable-lttvstatic CFLAGS="$2" LDFLAGS="$3"; make; make install) >& build.`basename $1`
+}
+
+RunTest () {
+ echo RunTest $1 $2
+ rm gmon.out
+ for version in $v1 $v2 $v3; do
+ /usr/bin/time $version/bin/lttv -m batchtest -t $tracedir $1 >& test.`basename $version`.$2
+ done
+ gprof $v2/bin/lttv >& test.profile.$2
+}
+
+BuildTest $v1 "-O2 -g" "-g"
+BuildTest $v2 "-pg -g -O2" "-pg -g"
+BuildTest $v3 "-g" "-g"
+
+RunTest --test1 countevents
+RunTest --test2 computestate
+RunTest --test4 computestats
+RunTest --test6 savestate
+RunTest "--test3 --test6 --test7 --seek-number 200" seekevents