Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loganalysis
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
tools
loganalysis
Commits
6397f54b
Commit
6397f54b
authored
6 years ago
by
Scott Lobdell
Browse files
Options
Downloads
Plain Diff
Merge QP1A.190228.005
Change-Id: I699e03d10b34ae5a03d35448ebdc1cda7aca2884
parents
0e0f3e5e
39b49e2f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/com/android/loganalysis/parser/DmesgParser.java
+17
-0
17 additions, 0 deletions
src/com/android/loganalysis/parser/DmesgParser.java
tests/src/com/android/loganalysis/parser/DmesgParserTest.java
+5
-3
5 additions, 3 deletions
...s/src/com/android/loganalysis/parser/DmesgParserTest.java
with
22 additions
and
3 deletions
src/com/android/loganalysis/parser/DmesgParser.java
+
17
−
0
View file @
6397f54b
...
@@ -42,6 +42,7 @@ public class DmesgParser implements IParser {
...
@@ -42,6 +42,7 @@ public class DmesgParser implements IParser {
private
static
final
String
ACTION
=
"ACTION"
;
private
static
final
String
ACTION
=
"ACTION"
;
private
static
final
String
DURATION
=
"DURATION"
;
private
static
final
String
DURATION
=
"DURATION"
;
private
static
final
String
UEVENTD
=
"ueventd"
;
private
static
final
String
UEVENTD
=
"ueventd"
;
private
static
final
String
INIT
=
"init"
;
// Matches: [ 14.822691] init:
// Matches: [ 14.822691] init:
private
static
final
String
SERVICE_PREFIX
=
String
.
format
(
"^\\[\\s+(?<%s>.*)\\] init:\\s+"
,
private
static
final
String
SERVICE_PREFIX
=
String
.
format
(
"^\\[\\s+(?<%s>.*)\\] init:\\s+"
,
...
@@ -94,6 +95,11 @@ public class DmesgParser implements IParser {
...
@@ -94,6 +95,11 @@ public class DmesgParser implements IParser {
private
static
final
Pattern
UEVENTD_STAGE_INFO
=
Pattern
.
compile
(
private
static
final
Pattern
UEVENTD_STAGE_INFO
=
Pattern
.
compile
(
String
.
format
(
"%s%s"
,
UEVENTD_PREFIX
,
STAGE_SUFFIX
));
String
.
format
(
"%s%s"
,
UEVENTD_PREFIX
,
STAGE_SUFFIX
));
private
static
final
String
PROPERTY_SUFFIX
=
String
.
format
(
"(?<%s>.*)\\s+took\\s+(?<%s>.*)ms$"
,
STAGE
,
DURATION
);
// Matches [ 7.270487] init: Wait for property 'apexd.status=ready' took 230ms
private
static
final
Pattern
WAIT_FOR_PROPERTY_INFO
=
Pattern
.
compile
(
String
.
format
(
"%s%s"
,
SERVICE_PREFIX
,
PROPERTY_SUFFIX
));
private
DmesgItem
mDmesgItem
=
new
DmesgItem
();
private
DmesgItem
mDmesgItem
=
new
DmesgItem
();
...
@@ -142,6 +148,7 @@ public class DmesgParser implements IParser {
...
@@ -142,6 +148,7 @@ public class DmesgParser implements IParser {
* @param line individual line of the dmesg log
* @param line individual line of the dmesg log
*/
*/
private
void
parse
(
String
line
)
{
private
void
parse
(
String
line
)
{
if
(
parseServiceInfo
(
line
))
{
if
(
parseServiceInfo
(
line
))
{
return
;
return
;
}
}
...
@@ -210,7 +217,17 @@ public class DmesgParser implements IParser {
...
@@ -210,7 +217,17 @@ public class DmesgParser implements IParser {
stageInfoItem
.
setDuration
((
long
)
(
Double
.
parseDouble
(
stageInfoItem
.
setDuration
((
long
)
(
Double
.
parseDouble
(
match
.
group
(
DURATION
))
*
1000
));
match
.
group
(
DURATION
))
*
1000
));
mDmesgItem
.
addStageInfoItem
(
stageInfoItem
);
mDmesgItem
.
addStageInfoItem
(
stageInfoItem
);
return
true
;
}
if
((
match
=
matches
(
WAIT_FOR_PROPERTY_INFO
,
line
))
!=
null
)
{
DmesgStageInfoItem
stageInfoItem
=
new
DmesgStageInfoItem
();
stageInfoItem
.
setStageName
(
String
.
format
(
"%s_%s"
,
INIT
,
match
.
group
(
STAGE
)));
stageInfoItem
.
setDuration
((
long
)
(
Double
.
parseDouble
(
match
.
group
(
DURATION
))));
mDmesgItem
.
addStageInfoItem
(
stageInfoItem
);
return
true
;
}
}
return
false
;
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/src/com/android/loganalysis/parser/DmesgParserTest.java
+
5
−
3
View file @
6397f54b
...
@@ -40,6 +40,7 @@ public class DmesgParserTest extends TestCase {
...
@@ -40,6 +40,7 @@ public class DmesgParserTest extends TestCase {
private
static
final
String
NETD
=
"netd"
;
private
static
final
String
NETD
=
"netd"
;
private
static
final
String
[]
LINES
=
private
static
final
String
[]
LINES
=
new
String
[]
{
new
String
[]
{
"[ 2.471163] init: Wait for property 'apexd.status=ready' took 403ms"
,
"[ 3.786943] ueventd: Coldboot took 0.701291 seconds"
,
"[ 3.786943] ueventd: Coldboot took 0.701291 seconds"
,
"[ 22.962730] init: starting service 'bootanim'..."
,
"[ 22.962730] init: starting service 'bootanim'..."
,
"[ 23.252321] init: starting service 'netd'..."
,
"[ 23.252321] init: starting service 'netd'..."
,
...
@@ -96,7 +97,7 @@ public class DmesgParserTest extends TestCase {
...
@@ -96,7 +97,7 @@ public class DmesgParserTest extends TestCase {
assertEquals
(
"Service info items list size should be 2"
,
2
,
assertEquals
(
"Service info items list size should be 2"
,
2
,
dmesgParser
.
getServiceInfoItems
().
size
());
dmesgParser
.
getServiceInfoItems
().
size
());
assertEquals
(
"Stage info items list size should be
2
"
,
2
,
assertEquals
(
"Stage info items list size should be
3
"
,
3
,
dmesgParser
.
getStageInfoItems
().
size
());
dmesgParser
.
getStageInfoItems
().
size
());
assertEquals
(
"Action info items list size should be 9"
,
9
,
assertEquals
(
"Action info items list size should be 9"
,
9
,
dmesgParser
.
getActionInfoItems
().
size
());
dmesgParser
.
getActionInfoItems
().
size
());
...
@@ -116,7 +117,7 @@ public class DmesgParserTest extends TestCase {
...
@@ -116,7 +117,7 @@ public class DmesgParserTest extends TestCase {
dmesgParser
.
parseInfo
(
bufferedReader
);
dmesgParser
.
parseInfo
(
bufferedReader
);
assertEquals
(
"Service info items list size should be 2"
,
2
,
assertEquals
(
"Service info items list size should be 2"
,
2
,
dmesgParser
.
getServiceInfoItems
().
size
());
dmesgParser
.
getServiceInfoItems
().
size
());
assertEquals
(
"Stage info items list size should be
2
"
,
2
,
assertEquals
(
"Stage info items list size should be
3
"
,
3
,
dmesgParser
.
getStageInfoItems
().
size
());
dmesgParser
.
getStageInfoItems
().
size
());
assertEquals
(
"Action info items list size should be 9"
,
9
,
assertEquals
(
"Action info items list size should be 9"
,
9
,
dmesgParser
.
getActionInfoItems
().
size
());
dmesgParser
.
getActionInfoItems
().
size
());
...
@@ -197,7 +198,7 @@ public class DmesgParserTest extends TestCase {
...
@@ -197,7 +198,7 @@ public class DmesgParserTest extends TestCase {
dmesgParser
.
parseStageInfo
(
line
);
dmesgParser
.
parseStageInfo
(
line
);
}
}
List
<
DmesgStageInfoItem
>
stageInfoItems
=
dmesgParser
.
getStageInfoItems
();
List
<
DmesgStageInfoItem
>
stageInfoItems
=
dmesgParser
.
getStageInfoItems
();
assertEquals
(
2
,
stageInfoItems
.
size
());
assertEquals
(
3
,
stageInfoItems
.
size
());
assertEquals
(
EXPECTED_STAGE_INFO_ITEMS
,
stageInfoItems
);
assertEquals
(
EXPECTED_STAGE_INFO_ITEMS
,
stageInfoItems
);
}
}
...
@@ -234,6 +235,7 @@ public class DmesgParserTest extends TestCase {
...
@@ -234,6 +235,7 @@ public class DmesgParserTest extends TestCase {
private
static
List
<
DmesgStageInfoItem
>
getExpectedStageInfoItems
()
{
private
static
List
<
DmesgStageInfoItem
>
getExpectedStageInfoItems
()
{
return
Arrays
.
asList
(
return
Arrays
.
asList
(
new
DmesgStageInfoItem
(
"init_Wait for property 'apexd.status=ready'"
,
null
,
403L
),
new
DmesgStageInfoItem
(
"ueventd_Coldboot"
,
null
,
701L
),
new
DmesgStageInfoItem
(
"ueventd_Coldboot"
,
null
,
701L
),
new
DmesgStageInfoItem
(
"first"
,
41665L
,
null
));
new
DmesgStageInfoItem
(
"first"
,
41665L
,
null
));
}
}
...
...
This diff is collapsed.
Click to expand it.
CodeLinaro
@codelinaro
mentioned in commit
b30c3299
·
8 months ago
mentioned in commit
b30c3299
mentioned in commit b30c3299e84693b9db9895f94458c6c78e404772
Toggle commit list
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