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
603df0e8
Commit
603df0e8
authored
9 years ago
by
Chih-hung Hsieh
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fix google-runtime-int warnings."
parents
7ed51942
ec2ff8c1
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
libbacktrace/BacktraceMap.cpp
+5
-4
5 additions, 4 deletions
libbacktrace/BacktraceMap.cpp
libbacktrace/GetPss.cpp
+4
-3
4 additions, 3 deletions
libbacktrace/GetPss.cpp
with
9 additions
and
7 deletions
libbacktrace/BacktraceMap.cpp
+
5
−
4
View file @
603df0e8
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
#include
<ctype.h>
#include
<ctype.h>
#include
<inttypes.h>
#include
<stdint.h>
#include
<stdint.h>
#include
<sys/types.h>
#include
<sys/types.h>
#include
<unistd.h>
#include
<unistd.h>
...
@@ -46,8 +47,8 @@ void BacktraceMap::FillIn(uintptr_t addr, backtrace_map_t* map) {
...
@@ -46,8 +47,8 @@ void BacktraceMap::FillIn(uintptr_t addr, backtrace_map_t* map) {
}
}
bool
BacktraceMap
::
ParseLine
(
const
char
*
line
,
backtrace_map_t
*
map
)
{
bool
BacktraceMap
::
ParseLine
(
const
char
*
line
,
backtrace_map_t
*
map
)
{
u
nsigned
long
in
t
start
;
u
int64_
t
start
;
u
nsigned
long
in
t
end
;
u
int64_
t
end
;
char
permissions
[
5
];
char
permissions
[
5
];
int
name_pos
;
int
name_pos
;
...
@@ -56,14 +57,14 @@ bool BacktraceMap::ParseLine(const char* line, backtrace_map_t* map) {
...
@@ -56,14 +57,14 @@ bool BacktraceMap::ParseLine(const char* line, backtrace_map_t* map) {
// __TEXT 0009f000-000a1000 [ 8K 8K] r-x/rwx SM=COW /Volumes/android/dalvik-dev/out/host/darwin-x86/bin/libcorkscrew_test\n
// __TEXT 0009f000-000a1000 [ 8K 8K] r-x/rwx SM=COW /Volumes/android/dalvik-dev/out/host/darwin-x86/bin/libcorkscrew_test\n
// 012345678901234567890123456789012345678901234567890123456789
// 012345678901234567890123456789012345678901234567890123456789
// 0 1 2 3 4 5
// 0 1 2 3 4 5
if
(
sscanf
(
line
,
"%*21c %
lx-%lx
[%*13c] %3c/%*3c SM=%*3c %n"
,
if
(
sscanf
(
line
,
"%*21c %
"
SCNx64
"-%"
SCNx64
"
[%*13c] %3c/%*3c SM=%*3c %n"
,
&
start
,
&
end
,
permissions
,
&
name_pos
)
!=
3
)
{
&
start
,
&
end
,
permissions
,
&
name_pos
)
!=
3
)
{
#else
#else
// Linux /proc/<pid>/maps lines:
// Linux /proc/<pid>/maps lines:
// 6f000000-6f01e000 rwxp 00000000 00:0c 16389419 /system/lib/libcomposer.so\n
// 6f000000-6f01e000 rwxp 00000000 00:0c 16389419 /system/lib/libcomposer.so\n
// 012345678901234567890123456789012345678901234567890123456789
// 012345678901234567890123456789012345678901234567890123456789
// 0 1 2 3 4 5
// 0 1 2 3 4 5
if
(
sscanf
(
line
,
"%
lx-%lx
%4s %*x %*x:%*x %*d %n"
,
if
(
sscanf
(
line
,
"%
"
SCNx64
"-%"
SCNx64
"
%4s %*x %*x:%*x %*d %n"
,
&
start
,
&
end
,
permissions
,
&
name_pos
)
!=
3
)
{
&
start
,
&
end
,
permissions
,
&
name_pos
)
!=
3
)
{
#endif
#endif
return
false
;
return
false
;
...
...
This diff is collapsed.
Click to expand it.
libbacktrace/GetPss.cpp
+
4
−
3
View file @
603df0e8
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
#define PAGEMAP_SWAP_OFFSET(x) (_BITS(x, 5, 50))
#define PAGEMAP_SWAP_OFFSET(x) (_BITS(x, 5, 50))
#define PAGEMAP_SWAP_TYPE(x) (_BITS(x, 0, 5))
#define PAGEMAP_SWAP_TYPE(x) (_BITS(x, 0, 5))
static
bool
ReadData
(
int
fd
,
unsigned
long
place
,
uint64_t
*
data
)
{
static
bool
ReadData
(
int
fd
,
off_t
place
,
uint64_t
*
data
)
{
if
(
lseek
(
fd
,
place
*
sizeof
(
uint64_t
),
SEEK_SET
)
<
0
)
{
if
(
lseek
(
fd
,
place
*
sizeof
(
uint64_t
),
SEEK_SET
)
<
0
)
{
return
false
;
return
false
;
}
}
...
@@ -71,12 +71,13 @@ size_t GetPssBytes() {
...
@@ -71,12 +71,13 @@ size_t GetPssBytes() {
total_pss
=
0
;
total_pss
=
0
;
break
;
break
;
}
}
for
(
size_t
page
=
start
/
pagesize
;
page
<
end
/
pagesize
;
page
++
)
{
for
(
off_t
page
=
static_cast
<
off_t
>
(
start
/
pagesize
);
page
<
static_cast
<
off_t
>
(
end
/
pagesize
);
page
++
)
{
uint64_t
data
;
uint64_t
data
;
if
(
ReadData
(
pagemap_fd
,
page
,
&
data
))
{
if
(
ReadData
(
pagemap_fd
,
page
,
&
data
))
{
if
(
PAGEMAP_PRESENT
(
data
)
&&
!
PAGEMAP_SWAPPED
(
data
))
{
if
(
PAGEMAP_PRESENT
(
data
)
&&
!
PAGEMAP_SWAPPED
(
data
))
{
uint64_t
count
;
uint64_t
count
;
if
(
ReadData
(
pagecount_fd
,
PAGEMAP_PFN
(
data
),
&
count
))
{
if
(
ReadData
(
pagecount_fd
,
static_cast
<
off_t
>
(
PAGEMAP_PFN
(
data
)
)
,
&
count
))
{
total_pss
+=
(
count
>=
1
)
?
pagesize
/
count
:
0
;
total_pss
+=
(
count
>=
1
)
?
pagesize
/
count
:
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