Пример #1
0
void DrawGame::CircleSprite::jumpTo( ofVec2f Pos )
{
  X = Pos.x;
  Y = Pos.y;  
  clearTrace();
  addTrace();
}
Пример #2
0
str
CMDclearTrace(void *res)
{
	(void) res;		/* fool compiler */
	clearTrace();
	return MAL_SUCCEED;
}
Пример #3
0
int main(int argc, char **argv)
{
    bool isRoot = (getuid() == 0);

    if (argc == 2 && 0 == strcmp(argv[1], "--help")) {
        showHelp(argv[0]);
        exit(0);
    }

    for (;;) {
        int ret;

        ret = getopt(argc, argv, "b:gcidflst:wz");

        if (ret < 0) {
            break;
        }

        switch(ret) {
            case 'g':
                if (!isRoot) {
                    fprintf(stderr, "error: tracing GPU power state requires root privileges\n");
                    exit(1);
                }
                g_traceGpuPower = true;
            break;

            case 'b':
                g_traceBufferSizeKB = atoi(optarg);
            break;

            case 'c':
                g_traceOverwrite = true;
            break;

            case 'i':
                g_traceCpuIdle = true;
            break;

            case 'l':
                g_traceGovernorLoad = true;
            break;

            case 'd':
                if (!isRoot) {
                    fprintf(stderr, "error: tracing disk activity requires root privileges\n");
                    exit(1);
                }
                g_traceDisk = true;
            break;

            case 'f':
                g_traceCpuFrequency = true;
            break;

            case 's':
                g_traceSchedSwitch = true;
            break;

            case 't':
                g_traceDurationSeconds = atoi(optarg);
            break;

            case 'w':
                if (!isRoot) {
                    fprintf(stderr, "error: tracing kernel work queues requires root privileges\n");
                    exit(1);
                }
                g_traceWorkqueue = true;
            break;

            case 'z':
                g_compress = true;
            break;

            default:
                fprintf(stderr, "\n");
                showHelp(argv[0]);
                exit(-1);
            break;
        }
    }

    registerSigHandler();

    bool ok = startTrace(isRoot);

    if (ok) {
        printf("capturing trace...");
        fflush(stdout);

        // We clear the trace after starting it because tracing gets enabled for
        // each CPU individually in the kernel. Having the beginning of the trace
        // contain entries from only one CPU can cause "begin" entries without a
        // matching "end" entry to show up if a task gets migrated from one CPU to
        // another.
        ok = clearTrace();

        if (ok) {
            // Sleep to allow the trace to be captured.
            struct timespec timeLeft;
            timeLeft.tv_sec = g_traceDurationSeconds;
            timeLeft.tv_nsec = 0;
            do {
                if (g_traceAborted) {
                    break;
                }
            } while (nanosleep(&timeLeft, &timeLeft) == -1 && errno == EINTR);
        }
    }

    // Stop the trace and restore the default settings.
    stopTrace(isRoot);

    if (ok) {
        if (!g_traceAborted) {
            printf(" done\nTRACE:\n");
            fflush(stdout);
            dumpTrace();
        } else {
            printf("\ntrace aborted.\n");
            fflush(stdout);
        }
        clearTrace();
    } else {
        fprintf(stderr, "unable to start tracing\n");
    }

    // Reset the trace buffer size to 1.
    setTraceBufferSizeKB(1);

    return g_traceAborted ? 1 : 0;
}
Пример #4
0
MeasurePanel::MeasurePanel(const QString &title,
                           QWidget *parent,
                           TraceManager *trace_manager,
                           const SweepSettings *sweep_settings) :
    DockPanel(title, parent),
    trace_manager_ptr(trace_manager),
    settings_ptr(sweep_settings)
{
    DockPage *trace_page = new DockPage("Traces");
    DockPage *marker_page = new DockPage("Markers");
    DockPage *offset_page = new DockPage("Offsets");
    channel_power_page = new DockPage("Channel Power");
    occupied_bandwidth_page = new DockPage("Occupied Bandwidth");

    QStringList string_list;

    trace_select = new ComboEntry("Trace");
    trace_type = new ComboEntry("Type");
    trace_avg_count = new NumericEntry("Avg Count", 10, "");
    trace_color = new ColorEntry("Color");
    //trace_active = new CheckBoxEntry("Active");
    trace_updating = new CheckBoxEntry("Update");
    export_clear = new DualButtonEntry("Export", "Clear");

    string_list << "One" << "Two" << "Three" << "Four" << "Five" << "Six";
    trace_select->setComboText(string_list);
    string_list.clear();

    // Must match TraceType enum list
    string_list << "Off" << "Clear & Write" << "Max Hold" << "Min Hold" <<
                   "Min/Max Hold" << "Average";
    trace_type->setComboText(string_list);
    string_list.clear();

    trace_page->AddWidget(trace_select);
    trace_page->AddWidget(trace_type);
    trace_page->AddWidget(trace_avg_count);
    trace_page->AddWidget(trace_color);
    trace_page->AddWidget(trace_updating);
    trace_page->AddWidget(export_clear);

    AppendPage(trace_page);

    connect(trace_select, SIGNAL(comboIndexChanged(int)),
            this, SLOT(updateTraceView(int)));
    connect(trace_type, SIGNAL(comboIndexChanged(int)),
            trace_manager_ptr, SLOT(setType(int)));
    connect(trace_avg_count, SIGNAL(valueChanged(double)),
            trace_manager_ptr, SLOT(setAvgCount(double)));
    connect(trace_color, SIGNAL(colorChanged(QColor&)),
            trace_manager_ptr, SLOT(setColor(QColor&)));
    connect(trace_updating, SIGNAL(clicked(bool)),
            trace_manager_ptr, SLOT(setUpdate(bool)));

    connect(export_clear, SIGNAL(leftPressed()),
            trace_manager_ptr, SLOT(exportTrace()));
    connect(export_clear, SIGNAL(rightPressed()),
            trace_manager_ptr, SLOT(clearTrace()));

    // Marker stuff
    marker_select = new ComboEntry("Marker");
    on_trace_select = new ComboEntry("Place On");
    setMarkerFreq = new FrequencyEntry("Set Freq", 1.0e6);
    marker_update = new CheckBoxEntry("Update");
    marker_active = new CheckBoxEntry("Active");
    peak_delta = new DualButtonEntry("Peak Search", "Delta");
    to_center_ref = new DualButtonEntry("To Center", "To Ref");
    peak_left_right = new DualButtonEntry("Peak Left", "Peak Right");

    string_list << "One" << "Two" << "Three" << "Four" << "Five" << "Six";
    marker_select->setComboText(string_list);
    string_list.clear();
    string_list << "Trace One" << "Trace Two" << "Trace Three"
                << "Trace Four" << "Trace Five" << "Trace Six";
    on_trace_select->setComboText(string_list);
    string_list.clear();

    marker_page->AddWidget(marker_select);
    marker_page->AddWidget(on_trace_select);
    marker_page->AddWidget(setMarkerFreq);
    marker_page->AddWidget(marker_update);
    marker_page->AddWidget(marker_active);
    marker_page->AddWidget(peak_delta);
    marker_page->AddWidget(to_center_ref);
    marker_page->AddWidget(peak_left_right);

    AppendPage(marker_page);

    connect(marker_select, SIGNAL(comboIndexChanged(int)),
            this, SLOT(updateMarkerView(int)));
    connect(on_trace_select, SIGNAL(comboIndexChanged(int)),
            trace_manager_ptr, SLOT(setMarkerOnTrace(int)));
    connect(setMarkerFreq, SIGNAL(freqViewChanged(Frequency)),
            this, SLOT(setMarkerFrequencyChanged(Frequency)));
    connect(marker_update, SIGNAL(clicked(bool)),
            trace_manager_ptr, SLOT(markerUpdate(bool)));
    connect(marker_active, SIGNAL(clicked(bool)),
            trace_manager_ptr, SLOT(markerActive(bool)));
    connect(peak_delta, SIGNAL(leftPressed()),
            trace_manager_ptr, SLOT(markerPeakSearch()));
    connect(peak_delta, SIGNAL(rightPressed()),
            trace_manager_ptr, SLOT(markerDeltaClicked()));
    connect(to_center_ref, SIGNAL(leftPressed()),
            trace_manager_ptr, SLOT(markerToCenter()));
    connect(to_center_ref, SIGNAL(rightPressed()),
            trace_manager_ptr, SLOT(markerToRef()));
    connect(peak_left_right, SIGNAL(leftPressed()),
            trace_manager_ptr, SLOT(markerPeakLeft()));
    connect(peak_left_right, SIGNAL(rightPressed()),
            trace_manager_ptr, SLOT(markerPeakRight()));

    ref_offset = new NumericEntry("Ref Offset",
                                  trace_manager_ptr->RefOffset(),
                                  "dB");

    offset_page->AddWidget(ref_offset);

    AppendPage(offset_page);

    connect(ref_offset, SIGNAL(valueChanged(double)),
            trace_manager_ptr, SLOT(setRefOffset(double)));

    channel_width = new FrequencyEntry("Width",
                                       20.0e6);
    channel_spacing = new FrequencyEntry("Spacing", 20.0e6);
    channel_power_enabled = new CheckBoxEntry("Enabled");

    channel_power_page->AddWidget(channel_width);
    channel_power_page->AddWidget(channel_spacing);
    channel_power_page->AddWidget(channel_power_enabled);

    AppendPage(channel_power_page);

    connect(channel_width, SIGNAL(freqViewChanged(Frequency)),
            this, SLOT(channelPowerUpdated()));
    connect(channel_spacing, SIGNAL(freqViewChanged(Frequency)),
            this, SLOT(channelPowerUpdated()));
    connect(channel_power_enabled, SIGNAL(clicked(bool)),
            this, SLOT(channelPowerUpdated()));

    ocbw_enabled = new CheckBoxEntry("Enabled");
    percentPower = new NumericEntry("% Power", 0.0, "");
    percentPower->SetValue(99.0);

    occupied_bandwidth_page->AddWidget(ocbw_enabled);
    occupied_bandwidth_page->AddWidget(percentPower);

    AppendPage(occupied_bandwidth_page);

    connect(ocbw_enabled, SIGNAL(clicked(bool)), SLOT(occupiedBandwidthUpdated()));
    connect(percentPower, SIGNAL(valueChanged(double)), SLOT(occupiedBandwidthUpdated()));

    // Done connected DockPages to TraceManager
    updateTraceView(0);
    updateMarkerView(0);

    // Miscellaneous connects
    connect(trace_manager_ptr, SIGNAL(updated()),
            this, SLOT(updateTraceView()));
    connect(trace_manager_ptr, SIGNAL(updated()),
            this, SLOT(updateMarkerView()));
}