- else
- {
- /* Set the navigation pointer to the end of the list */
- lEvent = pSysView->EventDB->LastEvent;
-
- /* Calculate distance from end */
- lPosition = (guint32) (pmVAdjust->upper - pmVAdjust->value);
-
- /* Find the event in the event database */
- while(lPosition > 0)
- {
- lPosition--;
- if(DBEventPrev(pSysView->EventDB, &lEvent) != TRUE)
- break;
- }
- }
-
- /* Fill the event list according to what was found */
- WDFillEventList(pSysView->Window->RTCList,
- pSysView->EventDB,
- pSysView->System,
- &lEvent,
- &(pSysView->Window->LastSelectedEvent));
-}
-
-
-
-/******************************************************************
- * Function :
- * WDConnectSignals()
- * Description :
- * Attaches signal handlers to the window items.
- * Parameters :
- * pmSysView, System view for which signals have to be connected
- * Return values :
- * NONE
- * History :
- * Note :
- * This function attaches a pointer to the main window during
- * the connect. This means that the handlers will get a pointer
- * to the window in the data argument.
- ******************************************************************/
-static void WDConnectSignals(systemView* pmSysView)
-{
- /* Raw event Popup menu */
- gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RawGotoProcess),
- "activate",
- GTK_SIGNAL_FUNC(SHGotoProcAnalysis),
- pmSysView);
- gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RawViewEvent),
- "activate",
- GTK_SIGNAL_FUNC(SHViewEventInEG),
- pmSysView);
-
- /* Set event list callbacks */
- gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RTCList),
- "select_row",
- GTK_SIGNAL_FUNC(SHRTEventSelect),
- pmSysView);
- gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RTCList),
- "button-press-event",
- GTK_SIGNAL_FUNC(SHRTEventButtonPress),
- pmSysView);
- gtk_signal_connect(GTK_OBJECT(pmSysView->Window->RTVAdjust),
- "value-changed",
- GTK_SIGNAL_FUNC(SHRTVAdjustValueChanged),
- pmSysView);
-
-
-}
-
-
-/******************************************************************
- * Function :
- * WDFillEventList()
- * Description :
- * Fills the window's event list using the trace database.
- * Parameters :
- * pmList, The list to be filled.
- * pmTraceDB, The database of events.
- * pmSystem, The system to which this list belongs.
- * pmEvent, Event from which we start drawing.
- * pmSelectedEvent, Event selected if any.
- * Return values :
- * NONE.
- * History :
- * K.Y., 18/06/99, Initial typing.
- * Note :
- ******************************************************************/
-static void WDFillEventList(GtkWidget* pmList,
- db* pmTraceDB,
- systemInfo* pmSystem,
- event* pmEvent,
- event* pmSelectedEvent)
-{
- gint i = 0; /* Generic index */
- event lEvent; /* Generic event */
- gchar lTimeStr[TIME_STR_LEN]; /* Time of event */
- static gchar* lString[RTCLIST_NB_COLUMNS]={'\0'}; /* Strings describing event */
- process* pProcess; /* Generic process pointer */
-#if SUPP_RTAI
- RTAItask* pTask = NULL; /* Generic task pointer */
-#endif /* SUPP_RTAI */
- eventDescription lEventDesc; /* Description of event */
-
- /* Did we allocate space for strings */
- if(lString[0] == NULL)
- /* Allocate space for strings */
- for (i = 0; i < RTCLIST_NB_COLUMNS - 1; i++)
- lString[i] = (char*) g_malloc(MW_DEFAULT_STRLEN);
-
- /* Allocate space for description string */
- lString[RTCLIST_NB_COLUMNS - 1] = (char*) g_malloc(MW_LONG_STRLEN);
-
- /* If no event was supplied, start at the beginning */
- if(pmEvent == NULL)
- lEvent = pmTraceDB->FirstEvent;
- else
- lEvent = *pmEvent;
-
- /* Freeze and clear clist */
- gtk_clist_freeze(GTK_CLIST(pmList));
- gtk_clist_clear(GTK_CLIST(pmList));
-
- /* Reset index */
- i = 0;
-
- /* Go through the event list */
- do
- {
- /* Get the event description */
- DBEventDescription(pmTraceDB, &lEvent, TRUE, &lEventDesc);
-
- /* Get the event's process */
- pProcess = DBEventProcess(pmTraceDB, &lEvent, pmSystem, FALSE);
-
-#if SUPP_RTAI
- /* Does this trace contain RTAI information */
- if(pmTraceDB->SystemType == TRACE_SYS_TYPE_RTAI_LINUX)
- /* Get the RTAI task to which this event belongs */
- pTask = RTAIDBEventTask(pmTraceDB, &lEvent, pmSystem, FALSE);
-#endif /* SUPP_RTAI */
-
- /* Set the event's entry in the list of raw events displayed */
- sRawEventsDisplayed[i] = lEvent;
-
- /* Add text describing the event */
- /* The CPU ID */
- if(pmTraceDB->LogCPUID == TRUE)
- snprintf(lString[0], MW_DEFAULT_STRLEN, "%d", lEventDesc.CPUID);
- else
- snprintf(lString[0], MW_DEFAULT_STRLEN, "0");
-
- /* The event ID */
- snprintf(lString[1], MW_DEFAULT_STRLEN, "%s", pmTraceDB->EventString(pmTraceDB, lEventDesc.ID, &lEvent));
-
- /* The event's time of occurence */
- DBFormatTimeInReadableString(lTimeStr,
- lEventDesc.Time.tv_sec,
- lEventDesc.Time.tv_usec);
- snprintf(lString[2], MW_DEFAULT_STRLEN, "%s", lTimeStr);
-
- /* Is this an RT event */
- if(lEventDesc.ID <= TRACE_MAX)
- {
- /* The PID of the process to which the event belongs */
- if(pProcess != NULL)
- snprintf(lString[3], MW_DEFAULT_STRLEN, "%d", pProcess->PID);
- else
- snprintf(lString[3], MW_DEFAULT_STRLEN, "N/A");
- }
-#if SUPP_RTAI
- else
- {
- /* The TID of the task to which the event belongs */
- if(pTask != NULL)
- snprintf(lString[3], MW_DEFAULT_STRLEN, "RT:%d", pTask->TID);
- else
- snprintf(lString[3], MW_DEFAULT_STRLEN, "RT:N/A");
- }
-#endif /* SUPP_RTAI */
-
- /* The size of the entry */
- snprintf(lString[4], MW_DEFAULT_STRLEN, "%d", lEventDesc.Size);
-
- /* The string describing the event */
- snprintf(lString[5], MW_LONG_STRLEN, "%s", lEventDesc.String);
-
- /* Insert the entry into the list */
- gtk_clist_append(GTK_CLIST(pmList), lString);
-
- /* Set the row's data to point to the current event */
- WDI_gtk_clist_set_last_row_data_full(GTK_CLIST(pmList), (gpointer) &(sRawEventsDisplayed[i]), NULL);
-
- /* Was this the last selected event */
- if(DBEventsEqual(lEvent, (*pmSelectedEvent)))
- gtk_clist_select_row(GTK_CLIST(pmList), i, 0);
-
- /* Go to next row */
- i++;
- } while((DBEventNext(pmTraceDB, &lEvent) == TRUE) && (i < RTCLIST_NB_ROWS));