/* *------------------------------------------------------------------ * Copyright (c) 2006-2016 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #define GTK_ENABLE_BROKEN // DGMS #include #include #include "g2.h" #include /* * locals */ static GtkWidget *s_mainmenubar; static GtkWidget *s_filemenu; static GtkWidget *s_readdefs; static GtkWidget *s_readevents; static GtkWidget *s_readeventsclock; static GtkWidget *s_readcpel; static GtkWidget *s_readclib; static GtkWidget *s_print; static GtkWidget *s_quit; static GtkWidget *s_mainfilemenu; static GtkWidget *s_help_general; static GtkWidget *s_help_about; static GtkWidget *s_mainhelpmenu; static GtkWidget *s_helpmenu; static GtkWidget *s_filesel; static GtkWidget *s_eventsel; typedef struct md_ { GtkWidget *entry; GtkWidget *label; GtkWidget *dialog; boolean (*callback)(char *); char *retry_text; } md_t; char *general_help = "\n" "G2 is a performance event visualization tool.\n" "\n" "To view CPEL-format event data:\n" "g2 --cpel \n" "or use the File Menu->Read CPEL file option.\n" "\n" "To view vppinfra-format (.../open-repo/vppinfra/vppinfra/elog.h) event data:\n" "g2 --clib \n" "or use the File Menu->Read clib file option.\n" "\n" "To toggle event detail boxes, left-mouse-click on an event.\n" "\n" "To zoom to an area, depress the left mouse button. Move the\n" "mouse. Release the mouse.\n" "\n" "To use the time ruler, depress the right mouse button. Move the\n" "mouse. Release when done.\n" "\n" "To push a track to the bottom, \n" "\n" "To pull a track to the top, \n" "\n" "To selectively color/uncolor a track, \n" "\n" "To make the mouse scrollwheel faster, press \n" "\n" "Hotkeys, supposedly Quake-like:\n" " w - zoom-in\n" " s - zoom-out\n" " a - pan-left\n" " d - pan-right\n" " r - pan-up\n" " f - pan-down\n" " t - less traces\n" " g - more traces\n" "\n" " e - toggle summary-mode\n" " c - toggle color-mode\n" "\n" " x - take snapshot\n" " z - go to next snapshot\n" " p - put snapshots to snapshots.g2 \n" " l - load snapshots from snapshots.g2\n" "\n" "q - quit\n" "Send comments / bug reports to the \"fd.io\" mailing list.\n"; /**************************************************************************** * debug_dialog_callback ****************************************************************************/ boolean debug_dialog_callback (char *s) { g_print("Dialog result: %s", s); return (TRUE); } /**************************************************************************** * get_dialog_value ****************************************************************************/ static void get_dialog_value (GtkWidget *dialog, gpointer user_data) { md_t *md = (md_t *)user_data; char * cb_arg; cb_arg = (char *) gtk_entry_get_text(GTK_ENTRY(md->entry)); if ((*md->callback)(cb_arg)) { gtk_grab_remove(md->dialog); gtk_widget_destroy(md->dialog); } else { gtk_label_set_text (GTK_LABEL(md->label), md->retry_text); } } /**************************************************************************** * modal_dialog ****************************************************************************/ void modal_dialog (char *label_text, char *retry_text, char *default_value, boolean (*cb)(char *)) { GtkWidget *dialog, *label, *ok_button, *entry; static md_t dlg; md_t *md = &dlg; dialog = gtk_dialog_new(); label = gtk_label_new(label_text); entry = gtk_entry_new(); if (default_value) gtk_entry_set_text(GTK_ENTRY(entry), default_value); ok_button = gtk_button_new_with_label("OK"); md->entry = entry; md->label = label; md->retry_text = retry_text; md->dialog = dialog; if (cb) md->callback = cb; else md->callback = debug_dialog_callback; gtk_signal_connect (GTK_OBJECT (ok_button), "clicked", GTK_SIGNAL_FUNC(get_dialog_value), (gpointer) md); gtk_signal_connect (GTK_OBJECT (entry), "activate", GTK_SIGNAL_FUNC(get_dialog_value), (gpointer) md); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), entry); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), ok_button); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); gtk_widget_show_all(dialog); gtk_widget_grab_focus(entry); gtk_grab_add(dialog); } /**************************************************************************** * get_eventdef_name ****************************************************************************/ static void get_eventdef_name (GtkFileSelection *sel, gpointer user_data) { char *filename = (char *) gtk_file_selection_get_filename ( GTK_FILE_SELECTION(s_filesel)); read_event_definitions(filename); set_window_title(filename); } /**************************************************************************** * read_eventdef_callback ****************************************************************************/ static void read_eventdef_callback(GtkToggleButton *item, gpointer data) { s_filesel = gtk_file_selection_new("Read Event Definitions From..."); gtk_f
# Copyright (c) 2018 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

add_vpp_plugin(vmxnet3
  SOURCES
  cli.c
  format.c
  input.c
  output.c
  plugin.c
  vmxnet3.c
  vmxnet3_api.c

  MULTIARCH_SOURCES
  input.c
  output.c

  API_FILES
  vmxnet3.api

  API_TEST_SOURCES
  vmxnet3_test.c

  INSTALL_HEADERS
  vmxnet3_all_api_h.h
  vmxnet3_msg_enum.h
)
K_OBJECT(s_readclib), "activate", GTK_SIGNAL_FUNC(read_clib_callback), 0); s_readdefs = gtk_menu_item_new_with_label ("Read Event Definitions"); gtk_menu_append(GTK_MENU(s_filemenu), s_readdefs); gtk_signal_connect(GTK_OBJECT(s_readdefs), "activate", GTK_SIGNAL_FUNC(read_eventdef_callback), 0); s_readevents = gtk_menu_item_new_with_label ("Read Event Log"); gtk_menu_append(GTK_MENU(s_filemenu), s_readevents); gtk_signal_connect(GTK_OBJECT(s_readevents), "activate", GTK_SIGNAL_FUNC(read_events_callback), 0); s_readeventsclock = gtk_menu_item_new_with_label ("Read Event Log with Different Clock Rate"); gtk_menu_append(GTK_MENU(s_filemenu), s_readeventsclock); gtk_signal_connect(GTK_OBJECT(s_readeventsclock), "activate", GTK_SIGNAL_FUNC(read_eventsclock_callback), 0); s_print = gtk_menu_item_new_with_label ("Print"); gtk_menu_append(GTK_MENU(s_filemenu), s_print); gtk_signal_connect(GTK_OBJECT(s_print), "activate", GTK_SIGNAL_FUNC(view1_print_callback), 0); s_quit = gtk_menu_item_new_with_label ("Exit"); gtk_menu_append(GTK_MENU(s_filemenu), s_quit); gtk_signal_connect(GTK_OBJECT(s_quit), "activate", GTK_SIGNAL_FUNC(gtk_main_quit), 0); s_mainfilemenu = gtk_menu_item_new_with_label("File"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(s_mainfilemenu), s_filemenu); s_helpmenu = gtk_menu_new(); s_help_general = gtk_menu_item_new_with_label ("General"); gtk_menu_append(GTK_MENU(s_helpmenu), s_help_general); gtk_signal_connect(GTK_OBJECT(s_help_general), "activate", GTK_SIGNAL_FUNC(help_general_callback), 0); s_help_about = gtk_menu_item_new_with_label ("About"); gtk_menu_append(GTK_MENU(s_helpmenu), s_help_about); gtk_signal_connect(GTK_OBJECT(s_help_about), "activate", GTK_SIGNAL_FUNC(help_about_callback), 0); s_mainhelpmenu = gtk_menu_item_new_with_label("Help"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(s_mainhelpmenu), s_helpmenu); s_mainmenubar = gtk_menu_bar_new(); gtk_menu_bar_append(GTK_MENU_BAR(s_mainmenubar), s_mainfilemenu); gtk_menu_bar_append(GTK_MENU_BAR(s_mainmenubar), s_mainhelpmenu); gtk_widget_show_all(s_mainmenubar); gtk_box_pack_start(GTK_BOX(g_mainvbox), s_mainmenubar, FALSE, FALSE, 0); }