Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
1dd991ee
Commit
1dd991ee
authored
1 year ago
by
Yi Kong
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "profcollect dex2oat observer" into main
parents
3cf2db8a
f8add98c
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
services/profcollect/Android.bp
+15
-14
15 additions, 14 deletions
services/profcollect/Android.bp
services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+42
-0
42 additions, 0 deletions
...roid/server/profcollect/ProfcollectForwardingService.java
with
57 additions
and
14 deletions
services/profcollect/Android.bp
+
15
−
14
View file @
1dd991ee
...
...
@@ -22,24 +22,25 @@ package {
}
filegroup {
name: "services.profcollect-javasources",
srcs: ["src/**/*.java"],
path: "src",
visibility: ["//frameworks/base/services"],
name: "services.profcollect-javasources",
srcs: ["src/**/*.java"],
path: "src",
visibility: ["//frameworks/base/services"],
}
filegroup {
name: "services.profcollect-sources",
srcs: [
":services.profcollect-javasources",
":profcollectd_aidl",
],
visibility: ["//frameworks/base/services:__subpackages__"],
name: "services.profcollect-sources",
srcs: [
":services.profcollect-javasources",
":profcollectd_aidl",
],
visibility: ["//frameworks/base/services:__subpackages__"],
}
java_library_static {
name: "services.profcollect",
defaults: ["platform_service_defaults"],
srcs: [":services.profcollect-sources"],
libs: ["services.core"],
name: "services.profcollect",
defaults: ["platform_service_defaults"],
srcs: [":services.profcollect-sources"],
static_libs: ["services.core"],
libs: ["service-art.stubs.system_server"],
}
This diff is collapsed.
Click to expand it.
services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+
42
−
0
View file @
1dd991ee
...
...
@@ -41,12 +41,15 @@ import android.util.Log;
import
com.android.internal.R
;
import
com.android.internal.os.BackgroundThread
;
import
com.android.server.IoThread
;
import
com.android.server.LocalManagerRegistry
;
import
com.android.server.LocalServices
;
import
com.android.server.SystemService
;
import
com.android.server.art.ArtManagerLocal
;
import
com.android.server.wm.ActivityMetricsLaunchObserver
;
import
com.android.server.wm.ActivityMetricsLaunchObserverRegistry
;
import
com.android.server.wm.ActivityTaskManagerInternal
;
import
java.util.concurrent.ForkJoinPool
;
import
java.util.concurrent.ThreadLocalRandom
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -261,6 +264,7 @@ public final class ProfcollectForwardingService extends SystemService {
BackgroundThread
.
get
().
getThreadHandler
().
post
(
()
->
{
registerAppLaunchObserver
();
registerDex2oatObserver
();
registerOTAObserver
();
});
}
...
...
@@ -304,6 +308,44 @@ public final class ProfcollectForwardingService extends SystemService {
}
}
private
void
registerDex2oatObserver
()
{
ArtManagerLocal
aml
=
LocalManagerRegistry
.
getManager
(
ArtManagerLocal
.
class
);
if
(
aml
==
null
)
{
Log
.
w
(
LOG_TAG
,
"Couldn't get ArtManagerLocal"
);
return
;
}
aml
.
setBatchDexoptStartCallback
(
ForkJoinPool
.
commonPool
(),
(
snapshot
,
reason
,
defaultPackages
,
builder
,
passedSignal
)
->
{
traceOnDex2oatStart
();
});
}
private
void
traceOnDex2oatStart
()
{
if
(
mIProfcollect
==
null
)
{
return
;
}
// Sample for a fraction of dex2oat runs.
final
int
traceFrequency
=
DeviceConfig
.
getInt
(
DeviceConfig
.
NAMESPACE_PROFCOLLECT_NATIVE_BOOT
,
"dex2oat_trace_freq"
,
10
);
int
randomNum
=
ThreadLocalRandom
.
current
().
nextInt
(
100
);
if
(
randomNum
<
traceFrequency
)
{
if
(
DEBUG
)
{
Log
.
d
(
LOG_TAG
,
"Tracing on dex2oat event"
);
}
BackgroundThread
.
get
().
getThreadHandler
().
post
(()
->
{
try
{
// Dex2oat could take a while before it starts. Add a short delay before start
// tracing.
Thread
.
sleep
(
1000
);
mIProfcollect
.
trace_once
(
"dex2oat"
);
}
catch
(
RemoteException
|
InterruptedException
e
)
{
Log
.
e
(
LOG_TAG
,
"Failed to initiate trace: "
+
e
.
getMessage
());
}
});
}
}
private
void
registerOTAObserver
()
{
UpdateEngine
updateEngine
=
new
UpdateEngine
();
updateEngine
.
bind
(
new
UpdateEngineCallback
()
{
...
...
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