Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31be80f0 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Add -n and -S options for 'nohup', offline traces

Change-Id: Ieef12b36b8519ff689ab5a81447b1b9bf4806171
parent e8744fd4
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ static bool g_traceWorkqueue = false;
static bool g_traceOverwrite = false;
static int g_traceBufferSizeKB = 2048;
static bool g_compress = false;
static bool g_nohup = false;
static int g_initialSleepSecs = 0;

/* Global state */
static bool g_traceAborted = false;
@@ -417,8 +419,10 @@ static void showHelp(const char *cmd)
}

static void handleSignal(int signo) {
    if (!g_nohup) {
        g_traceAborted = true;
    }
}

static void registerSigHandler() {
    struct sigaction sa;
@@ -443,7 +447,7 @@ int main(int argc, char **argv)
    for (;;) {
        int ret;

        ret = getopt(argc, argv, "b:cidflst:uwz");
        ret = getopt(argc, argv, "b:cidflst:uwznS:");

        if (ret < 0) {
            break;
@@ -478,10 +482,18 @@ int main(int argc, char **argv)
                g_traceFrequency = true;
            break;

            case 'n':
                g_nohup = true;
                break;

            case 's':
                g_traceSchedSwitch = true;
            break;

            case 'S':
                g_initialSleepSecs = atoi(optarg);
            break;

            case 't':
                g_traceDurationSeconds = atoi(optarg);
            break;
@@ -516,6 +528,10 @@ int main(int argc, char **argv)

    registerSigHandler();

    if (g_initialSleepSecs > 0) {
        sleep(g_initialSleepSecs);
    }

    bool ok = startTrace(isRoot);

    if (ok) {