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

Side by Side Diff: tools/android/memtrack_helper/memtrack_helper.h

Issue 2389883004: Benchmark tools: Android memtrack_helper meaningful errors. (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The Chromium Authors. All rights reserved. 2 * Copyright 2015 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #ifndef TOOLS_ANDROID_MEMTRACK_HELPER_H_ 7 #ifndef TOOLS_ANDROID_MEMTRACK_HELPER_H_
8 #define TOOLS_ANDROID_MEMTRACK_HELPER_H_ 8 #define TOOLS_ANDROID_MEMTRACK_HELPER_H_
9 9
10 #include <android/log.h>
10 #include <errno.h> 11 #include <errno.h>
11 #include <stdio.h> 12 #include <stdio.h>
12 #include <stdlib.h> 13 #include <stdlib.h>
13 #include <string.h> 14 #include <string.h>
14 #include <sys/socket.h> 15 #include <sys/socket.h>
15 #include <sys/un.h> 16 #include <sys/un.h>
16 17
17 static inline void exit_with_failure(const char* reason) { 18 static inline void exit_with_failure(const char* reason) {
18 perror(reason); 19 perror(reason);
20 __android_log_write(ANDROID_LOG_ERROR, "memtrack_helper", reason);
19 exit(EXIT_FAILURE); 21 exit(EXIT_FAILURE);
20 } 22 }
21 23
22 static inline void init_memtrack_server_addr(struct sockaddr_un* addr) { 24 static inline void init_memtrack_server_addr(struct sockaddr_un* addr) {
23 const char* const kAbstractSocketName = "chrome_tracing_memtrack_helper"; 25 const char* const kAbstractSocketName = "chrome_tracing_memtrack_helper";
24 memset(addr, 0, sizeof(*addr)); 26 memset(addr, 0, sizeof(*addr));
25 addr->sun_family = AF_UNIX; 27 addr->sun_family = AF_UNIX;
26 strncpy(&addr->sun_path[1], kAbstractSocketName, sizeof(addr->sun_path) - 2); 28 strncpy(&addr->sun_path[1], kAbstractSocketName, sizeof(addr->sun_path) - 2);
27 } 29 }
28 30
29 #endif // TOOLS_ANDROID_MEMTRACK_HELPER_H_ 31 #endif // TOOLS_ANDROID_MEMTRACK_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698