Loading cmds/atrace/Android.mk +1 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ LOCAL_SHARED_LIBRARIES := \ libcutils \ libcutils \ libutils \ libutils \ libz \ libz \ libbase LOCAL_INIT_RC := atrace.rc LOCAL_INIT_RC := atrace.rc Loading cmds/atrace/atrace.cpp +6 −16 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include <utils/Timers.h> #include <utils/Timers.h> #include <utils/Tokenizer.h> #include <utils/Tokenizer.h> #include <utils/Trace.h> #include <utils/Trace.h> #include <android-base/file.h> using namespace android; using namespace android; Loading Loading @@ -525,24 +526,14 @@ static bool disableKernelTraceEvents() { // kernel. // kernel. static bool verifyKernelTraceFuncs(const char* funcs) static bool verifyKernelTraceFuncs(const char* funcs) { { int fd = open(k_ftraceFilterPath, O_RDONLY); std::string buf; if (fd == -1) { if (!android::base::ReadFileToString(k_ftraceFilterPath, &buf)) { fprintf(stderr, "error opening %s: %s (%d)\n", k_ftraceFilterPath, fprintf(stderr, "error opening %s: %s (%d)\n", k_ftraceFilterPath, strerror(errno), errno); strerror(errno), errno); return false; return false; } } char buf[4097]; String8 funcList = String8::format("\n%s",buf.c_str()); ssize_t n = read(fd, buf, 4096); close(fd); if (n == -1) { fprintf(stderr, "error reading %s: %s (%d)\n", k_ftraceFilterPath, strerror(errno), errno); return false; } buf[n] = '\0'; String8 funcList = String8::format("\n%s", buf); // Make sure that every function listed in funcs is in the list we just // Make sure that every function listed in funcs is in the list we just // read from the kernel, except for wildcard inputs. // read from the kernel, except for wildcard inputs. Loading @@ -562,7 +553,6 @@ static bool verifyKernelTraceFuncs(const char* funcs) func = strtok(NULL, ","); func = strtok(NULL, ","); } } free(myFuncs); free(myFuncs); return ok; return ok; } } Loading Loading
cmds/atrace/Android.mk +1 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ LOCAL_SHARED_LIBRARIES := \ libcutils \ libcutils \ libutils \ libutils \ libz \ libz \ libbase LOCAL_INIT_RC := atrace.rc LOCAL_INIT_RC := atrace.rc Loading
cmds/atrace/atrace.cpp +6 −16 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ #include <utils/Timers.h> #include <utils/Timers.h> #include <utils/Tokenizer.h> #include <utils/Tokenizer.h> #include <utils/Trace.h> #include <utils/Trace.h> #include <android-base/file.h> using namespace android; using namespace android; Loading Loading @@ -525,24 +526,14 @@ static bool disableKernelTraceEvents() { // kernel. // kernel. static bool verifyKernelTraceFuncs(const char* funcs) static bool verifyKernelTraceFuncs(const char* funcs) { { int fd = open(k_ftraceFilterPath, O_RDONLY); std::string buf; if (fd == -1) { if (!android::base::ReadFileToString(k_ftraceFilterPath, &buf)) { fprintf(stderr, "error opening %s: %s (%d)\n", k_ftraceFilterPath, fprintf(stderr, "error opening %s: %s (%d)\n", k_ftraceFilterPath, strerror(errno), errno); strerror(errno), errno); return false; return false; } } char buf[4097]; String8 funcList = String8::format("\n%s",buf.c_str()); ssize_t n = read(fd, buf, 4096); close(fd); if (n == -1) { fprintf(stderr, "error reading %s: %s (%d)\n", k_ftraceFilterPath, strerror(errno), errno); return false; } buf[n] = '\0'; String8 funcList = String8::format("\n%s", buf); // Make sure that every function listed in funcs is in the list we just // Make sure that every function listed in funcs is in the list we just // read from the kernel, except for wildcard inputs. // read from the kernel, except for wildcard inputs. Loading @@ -562,7 +553,6 @@ static bool verifyKernelTraceFuncs(const char* funcs) func = strtok(NULL, ","); func = strtok(NULL, ","); } } free(myFuncs); free(myFuncs); return ok; return ok; } } Loading