diff --git a/atrace/atrace.c b/atrace/atrace.c
index 2d9b4f8..64f13e4 100644
--- a/atrace/atrace.c
+++ b/atrace/atrace.c
@@ -16,6 +16,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <getopt.h>
 #include <signal.h>
 #include <stdarg.h>
 #include <stdbool.h>
@@ -432,7 +433,12 @@
                     "  -u              trace bus utilization\n"
                     "  -w              trace the kernel workqueue\n"
                     "  -y              trace sync timelines and waits\n"
-                    "  -z              compress the trace dump\n");
+                    "  -z              compress the trace dump\n"
+                    "  --async_start   start circular trace and return immediatly\n"
+                    "  --async_dump    dump the current contents of circular trace buffer\n"
+                    "  --async_stop    stop tracing and dump the current contents of circular\n"
+                    "                    trace buffer\n"
+            );
 }
 
 static void handleSignal(int signo) {
@@ -455,6 +461,10 @@
 int main(int argc, char **argv)
 {
     bool isRoot = (getuid() == 0);
+    bool async = false;
+    bool traceStart = true;
+    bool traceStop = true;
+    bool traceDump = true;
 
     if (argc == 2 && 0 == strcmp(argv[1], "--help")) {
         showHelp(argv[0]);
@@ -463,8 +473,16 @@
 
     for (;;) {
         int ret;
+        int option_index = 0;
+        static struct option long_options[] = {
+            {"async_start",     no_argument, 0,  0 },
+            {"async_stop",      no_argument, 0,  0 },
+            {"async_dump",      no_argument, 0,  0 },
+            {0,         0,                 0,  0 }
+        };
 
-        ret = getopt(argc, argv, "b:cidflst:uwyznS:");
+        ret = getopt_long(argc, argv, "b:cidflst:uwyznS:",
+                          long_options, &option_index);
 
         if (ret < 0) {
             break;
@@ -543,6 +561,22 @@
                 g_compress = true;
             break;
 
+            case 0:
+                if (!strcmp(long_options[option_index].name, "async_start")) {
+                    async = true;
+                    traceStop = false;
+                    traceDump = false;
+                    g_traceOverwrite = true;
+                } else if (!strcmp(long_options[option_index].name, "async_stop")) {
+                    async = true;
+                    traceStop = false;
+                } else if (!strcmp(long_options[option_index].name, "async_dump")) {
+                    async = true;
+                    traceStart = false;
+                    traceStop = false;
+                }
+                break;
+
             default:
                 fprintf(stderr, "\n");
                 showHelp(argv[0]);
@@ -559,7 +593,7 @@
 
     bool ok = startTrace(isRoot);
 
-    if (ok) {
+    if (ok && traceStart) {
         printf("capturing trace...");
         fflush(stdout);
 
@@ -570,7 +604,7 @@
         // another.
         ok = clearTrace();
 
-        if (ok) {
+        if (ok && !async) {
             // Sleep to allow the trace to be captured.
             struct timespec timeLeft;
             timeLeft.tv_sec = g_traceDurationSeconds;
@@ -584,9 +618,10 @@
     }
 
     // Stop the trace and restore the default settings.
-    stopTrace(isRoot);
+    if (traceStop)
+        stopTrace(isRoot);
 
-    if (ok) {
+    if (ok && traceDump) {
         if (!g_traceAborted) {
             printf(" done\nTRACE:\n");
             fflush(stdout);
@@ -596,12 +631,13 @@
             fflush(stdout);
         }
         clearTrace();
-    } else {
+    } else if (!ok) {
         fprintf(stderr, "unable to start tracing\n");
     }
 
     // Reset the trace buffer size to 1.
-    setTraceBufferSizeKB(1);
+    if (traceStop)
+        setTraceBufferSizeKB(1);
 
     return g_traceAborted ? 1 : 0;
 }
