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
06bfaa70
Commit
06bfaa70
authored
Feb 13, 2016
by
James Hawkins
Committed by
Gerrit Code Review
Feb 13, 2016
Browse files
Options
Downloads
Plain Diff
Merge "bootstat: Add a few more bootreasons and rebase the index against index 1."
parents
8b68829c
6f74c0b8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bootstat/bootstat.cpp
+23
-17
23 additions, 17 deletions
bootstat/bootstat.cpp
with
23 additions
and
17 deletions
bootstat/bootstat.cpp
+
23
−
17
View file @
06bfaa70
...
...
@@ -105,33 +105,39 @@ std::string GetProperty(const char* key) {
return
std
::
string
(
&
temp
[
0
],
len
);
}
constexpr
int32_t
kUnknownBootReason
=
1
;
// A mapping from boot reason string, as read from the ro.boot.bootreason
// system property, to a unique integer ID. Viewers of log data dashboards for
// the boot_reason metric may refer to this mapping to discern the histogram
// values.
const
std
::
map
<
std
::
string
,
int
>
kBootReasonMap
=
{
{
"normal"
,
0
},
{
"recovery"
,
1
},
{
"reboot"
,
2
},
{
"PowerKey"
,
3
},
{
"hard_reset"
,
4
},
{
"kernel_panic"
,
5
},
{
"rpm_err"
,
6
},
{
"hw_reset"
,
7
},
{
"tz_err"
,
8
},
{
"adsp_err"
,
9
},
{
"modem_err"
,
10
},
{
"mba_err"
,
11
},
{
"Watchdog"
,
12
},
{
"Panic"
,
13
},
const
std
::
map
<
std
::
string
,
int32_t
>
kBootReasonMap
=
{
{
"unknown"
,
kUnknownBootReason
},
{
"normal"
,
2
},
{
"recovery"
,
3
},
{
"reboot"
,
4
},
{
"PowerKey"
,
5
},
{
"hard_reset"
,
6
},
{
"kernel_panic"
,
7
},
{
"rpm_err"
,
8
},
{
"hw_reset"
,
9
},
{
"tz_err"
,
10
},
{
"adsp_err"
,
11
},
{
"modem_err"
,
12
},
{
"mba_err"
,
13
},
{
"Watchdog"
,
14
},
{
"Panic"
,
15
},
{
"power_key"
,
16
},
{
"power_on"
,
17
},
{
"Reboot"
,
18
},
{
"rtc"
,
19
},
{
"edl"
,
20
},
};
// Converts a string value representing the reason the system booted to an
// integer representation. This is necessary for logging the boot_reason metric
// via Tron, which does not accept non-integer buckets in histograms.
int32_t
BootReasonStrToEnum
(
const
std
::
string
&
boot_reason
)
{
static
const
int32_t
kUnknownBootReason
=
-
1
;
auto
mapping
=
kBootReasonMap
.
find
(
boot_reason
);
if
(
mapping
!=
kBootReasonMap
.
end
())
{
return
mapping
->
second
;
...
...
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