Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AndroidSystemCore
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Werner Sembach
AndroidSystemCore
Commits
a8ac32c7
Commit
a8ac32c7
authored
Apr 15, 2015
by
Yabin Cui
Browse files
Options
Downloads
Patches
Plain Diff
Move trace.h to stdatomic.
Bug: 20262261 Change-Id: Idaf984786804eb76c285f38b11abbbc0d3706509
parent
89e2f942
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/cutils/trace.h
+3
-3
3 additions, 3 deletions
include/cutils/trace.h
libcutils/trace-dev.c
+7
-7
7 additions, 7 deletions
libcutils/trace-dev.c
libcutils/trace-host.c
+1
-1
1 addition, 1 deletion
libcutils/trace-host.c
with
11 additions
and
11 deletions
include/cutils/trace.h
+
3
−
3
View file @
a8ac32c7
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#define _LIBS_CUTILS_TRACE_H
#define _LIBS_CUTILS_TRACE_H
#include
<inttypes.h>
#include
<inttypes.h>
#include
<stdatomic.h>
#include
<stdbool.h>
#include
<stdbool.h>
#include
<stdint.h>
#include
<stdint.h>
#include
<stdio.h>
#include
<stdio.h>
...
@@ -25,7 +26,6 @@
...
@@ -25,7 +26,6 @@
#include
<sys/types.h>
#include
<sys/types.h>
#include
<unistd.h>
#include
<unistd.h>
#include
<cutils/atomic.h>
#include
<cutils/compiler.h>
#include
<cutils/compiler.h>
__BEGIN_DECLS
__BEGIN_DECLS
...
@@ -113,7 +113,7 @@ void atrace_set_tracing_enabled(bool enabled);
...
@@ -113,7 +113,7 @@ void atrace_set_tracing_enabled(bool enabled);
* Nonzero indicates setup has completed.
* Nonzero indicates setup has completed.
* Note: This does NOT indicate whether or not setup was successful.
* Note: This does NOT indicate whether or not setup was successful.
*/
*/
extern
volatile
int32_t
atrace_is_ready
;
extern
atomic_bool
atrace_is_ready
;
/**
/**
* Set of ATRACE_TAG flags to trace for, initialized to ATRACE_TAG_NOT_READY.
* Set of ATRACE_TAG flags to trace for, initialized to ATRACE_TAG_NOT_READY.
...
@@ -136,7 +136,7 @@ extern int atrace_marker_fd;
...
@@ -136,7 +136,7 @@ extern int atrace_marker_fd;
#define ATRACE_INIT() atrace_init()
#define ATRACE_INIT() atrace_init()
static
inline
void
atrace_init
()
static
inline
void
atrace_init
()
{
{
if
(
CC_UNLIKELY
(
!
a
ndroid_atomic_acquire_load
(
&
atrace_is_ready
)))
{
if
(
CC_UNLIKELY
(
!
a
tomic_load_explicit
(
&
atrace_is_ready
,
memory_order_acquire
)))
{
atrace_setup
();
atrace_setup
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
libcutils/trace-dev.c
+
7
−
7
View file @
a8ac32c7
...
@@ -18,11 +18,11 @@
...
@@ -18,11 +18,11 @@
#include
<fcntl.h>
#include
<fcntl.h>
#include
<limits.h>
#include
<limits.h>
#include
<pthread.h>
#include
<pthread.h>
#include
<stdatomic.h>
#include
<stdbool.h>
#include
<stdbool.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
#include
<sys/types.h>
#include
<sys/types.h>
#include
<cutils/atomic.h>
#include
<cutils/compiler.h>
#include
<cutils/compiler.h>
#include
<cutils/properties.h>
#include
<cutils/properties.h>
#include
<cutils/trace.h>
#include
<cutils/trace.h>
...
@@ -37,11 +37,11 @@
...
@@ -37,11 +37,11 @@
*/
*/
#define ATRACE_MESSAGE_LENGTH 1024
#define ATRACE_MESSAGE_LENGTH 1024
volatile
int32_t
atrace_is_ready
=
0
;
atomic_bool
atrace_is_ready
=
ATOMIC_VAR_INIT
(
false
)
;
int
atrace_marker_fd
=
-
1
;
int
atrace_marker_fd
=
-
1
;
uint64_t
atrace_enabled_tags
=
ATRACE_TAG_NOT_READY
;
uint64_t
atrace_enabled_tags
=
ATRACE_TAG_NOT_READY
;
static
bool
atrace_is_debuggable
=
false
;
static
bool
atrace_is_debuggable
=
false
;
static
volatile
int32_t
atrace_is_enabled
=
1
;
static
atomic_bool
atrace_is_enabled
=
ATOMIC_VAR_INIT
(
true
)
;
static
pthread_once_t
atrace_once_control
=
PTHREAD_ONCE_INIT
;
static
pthread_once_t
atrace_once_control
=
PTHREAD_ONCE_INIT
;
static
pthread_mutex_t
atrace_tags_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
atrace_tags_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
...
@@ -58,7 +58,7 @@ void atrace_set_debuggable(bool debuggable)
...
@@ -58,7 +58,7 @@ void atrace_set_debuggable(bool debuggable)
// the Zygote process from tracing.
// the Zygote process from tracing.
void
atrace_set_tracing_enabled
(
bool
enabled
)
void
atrace_set_tracing_enabled
(
bool
enabled
)
{
{
a
ndroid_atomic_release_store
(
enabled
?
1
:
0
,
&
atrace_is_enabled
);
a
tomic_store_explicit
(
&
atrace_is_enabled
,
enabled
,
memory_order_release
);
atrace_update_tags
();
atrace_update_tags
();
}
}
...
@@ -155,8 +155,8 @@ static uint64_t atrace_get_property()
...
@@ -155,8 +155,8 @@ static uint64_t atrace_get_property()
void
atrace_update_tags
()
void
atrace_update_tags
()
{
{
uint64_t
tags
;
uint64_t
tags
;
if
(
CC_UNLIKELY
(
a
ndroid_atomic_acquire_load
(
&
atrace_is_ready
)))
{
if
(
CC_UNLIKELY
(
a
tomic_load_explicit
(
&
atrace_is_ready
,
memory_order_acquire
)))
{
if
(
a
ndroid_atomic_acquire_load
(
&
atrace_is_enabled
))
{
if
(
a
tomic_load_explicit
(
&
atrace_is_enabled
,
memory_order_acquire
))
{
tags
=
atrace_get_property
();
tags
=
atrace_get_property
();
pthread_mutex_lock
(
&
atrace_tags_mutex
);
pthread_mutex_lock
(
&
atrace_tags_mutex
);
atrace_enabled_tags
=
tags
;
atrace_enabled_tags
=
tags
;
...
@@ -183,7 +183,7 @@ static void atrace_init_once()
...
@@ -183,7 +183,7 @@ static void atrace_init_once()
atrace_enabled_tags
=
atrace_get_property
();
atrace_enabled_tags
=
atrace_get_property
();
done:
done:
a
ndroid_atomic_release_store
(
1
,
&
atrace_is_ready
);
a
tomic_store_explicit
(
&
atrace_is_ready
,
true
,
memory_order_release
);
}
}
void
atrace_setup
()
void
atrace_setup
()
...
...
This diff is collapsed.
Click to expand it.
libcutils/trace-host.c
+
1
−
1
View file @
a8ac32c7
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#define __unused __attribute__((__unused__))
#define __unused __attribute__((__unused__))
#endif
#endif
volatile
int32_t
atrace_is_ready
=
1
;
atomic_bool
atrace_is_ready
=
ATOMIC_VAR_INIT
(
true
)
;
int
atrace_marker_fd
=
-
1
;
int
atrace_marker_fd
=
-
1
;
uint64_t
atrace_enabled_tags
=
0
;
uint64_t
atrace_enabled_tags
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment