Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: systrace/atrace_helper/jni/logging.h

Issue 2946033002: Android systrace: Optimize memory dumps. (Closed)
Patch Set: tiny fix Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « systrace/atrace_helper/jni/libmemtrack_wrapper.h ('k') | systrace/atrace_helper/jni/main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef LOGGING_H_ 5 #ifndef LOGGING_H_
6 #define LOGGING_H_ 6 #define LOGGING_H_
7 7
8 #include <android/log.h> 8 #include <android/log.h>
9 #include <errno.h>
9 #include <stdio.h> 10 #include <stdio.h>
10 #include <stdlib.h> 11 #include <stdlib.h>
11 12
12 #define CHECK_ARGS(COND, ERR) \ 13 #define CHECK_ARGS(COND, ERR) \
13 "FAILED CHECK(%s) @ %s:%d (errno: %s)\n", #COND, __FILE__, __LINE__, \ 14 "FAILED CHECK(%s) @ %s:%d (errno: %s)\n", #COND, __FILE__, __LINE__, \
14 strerror(ERR) 15 strerror(ERR)
15 16
16 #define CHECK(x) \ 17 #define CHECK(x) \
17 do { \ 18 do { \
18 if (!(x)) { \ 19 if (!(x)) { \
19 const int e = errno; \ 20 const int e = errno; \
20 __android_log_print(ANDROID_LOG_FATAL, "atrace_helper", \ 21 __android_log_print(ANDROID_LOG_FATAL, "atrace_helper", \
21 CHECK_ARGS(x, e)); \ 22 CHECK_ARGS(x, e)); \
22 fprintf(stderr, "\n" CHECK_ARGS(x, e)); \ 23 fprintf(stderr, "\n" CHECK_ARGS(x, e)); \
23 fflush(stderr); \ 24 fflush(stderr); \
24 abort(); \ 25 abort(); \
25 } \ 26 } \
26 } while (0) 27 } while (0)
27 28
28 inline void LogError(const char* message) { 29 inline void LogError(const char* message) {
29 __android_log_write(ANDROID_LOG_ERROR, "atrace_helper", message); 30 __android_log_write(ANDROID_LOG_ERROR, "atrace_helper", message);
30 fprintf(stderr, "\n%s\n", message); 31 fprintf(stderr, "\n%s\n", message);
31 fflush(stderr); 32 fflush(stderr);
32 } 33 }
33 34
34 #endif // LOGGING_H_ 35 #endif // LOGGING_H_
OLDNEW
« no previous file with comments | « systrace/atrace_helper/jni/libmemtrack_wrapper.h ('k') | systrace/atrace_helper/jni/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698