SlideShare a Scribd company logo
1 of 61
Download to read offline
Tools and Techniques for Understanding Threading
Behavior in Android*
Dr. Ramesh Peri
Sr. Principal Engineer & Architect of Android tools
Intel Corporation
Austin, TX 78746
Email: ramesh.v.peri@intel.com
2
Agenda
Goals
Tools Roundup
Intel® VtuneTM, Linux Perf, Nvidia* System Profiler, Google* Systrace, ARM* DS-5
Threading Examples
Simple Example
Simple Threading
Communicating Threads
Simultaneously executing threads
Lazy Thread
False Sharing
3
Goals
Learn about performance analysis tools in Android
Develop simple micro-benchmarks and run them under the control of a performance
analysis tool
Interpret and validate the data
Understand Threading models used in Android
Core to thread mapping
Has Impact on
– responsiveness
– power and
– performance
4
Intel® VTuneTM
5
Nvidia* System Profiler
6
Google* Systrace
7
ARM* DS-5
8
Linux Perf
kcachegrind
Basic commands
Annotated Source view
Hotspot
Tools
9
Feature Vtune Linux Perf
Nivida System
Profiler
Google Systrace ARM DS-5
OTB Experience Hard Hard Hard Easy Hard
TimeLine Yes No No Yes Yes
Java Source Yes Limited No No Maybe
Gridview(HotSpot) Yes Yes Yes No Yes
h/w events Yes Limited Limited No Yes
OS events Limited Yes Limited Yes Yes
Filtering Yes No No No No
Grouping Yes Limited No No Limited
Call Stack Yes Yes Yes No Yes
Platform View Yes No No No Limited
Devices
10
Nexus 7 Dell Venue 8 Nvidia Shield
Processor Snapdragon S4 CLTP/Merrifield Tegra K1
Frequency 1.5Ghz 1.3Ghz 2.2Ghz
Memory 2 1 2
Number of Cores 4 2 4
Android Version 4.3 4.3 4.4
Storage 32 16 32
Manufacturer Qualcomm Intel Nvidia
Display 1920x1200 1920x1200 1920x1200
Device Resources
11
Dell Venue 8
http://software.intel.com/mdk
http://opensource.dell.com
Nvidia Shield
https://developer.nvidia.com/develop4shield
Nexus 7
http://play.google.com
Simple Example
12
A Simple Example
13
public void showValue(View v) {
int i, j, sum=0;
for (i=0;i<10000;i++)
for (j=0;j<10000;j++)
sum+=i;
TextView tv = (TextView)findViewById(R.id.textView2);
tv.setText(String.valueOf(sum));
}
public void clearValue(View v) {
TextView tv = (TextView)findViewById(R.id.textView2);
tv.setText("");
}
textview2
Performance Profile
14
Timeline
Gives you the birds eye-view of overall execution
GridView
Data Grouping
15
Mostly using core 1
Allows you to look at data in multiple ways
Filtering
16
Second press used
Core 0
Mouse right
button click
Lets you focus on specific events in the execution
Java Source to Assembly Mapping
17
The hot loop Jit asm to source java correlation
The hot loop in
assembly
Requires support in the Dalvik/Art runtime
Arm Streamline on Nvidia Shield
18
Two cores active
Systrace on Nvidia Shield for 6 key presses
19
Nvidia System Profiler on Nvidia Shield
20
TimeLine
Grid view with
callstacks
Zoom and Filter
21
Observation
All key presses are handled by one thread
The thread is mapped to different cores at different times
Core 1 is handling most of the work in the application for venue8
Core 0 and core 1 are active on Nvidia shield
Core 1 is doing the compute and core 0 seems to be active with the OS and another
process
Simple Threading
22
Simple Threading
23
public void showValue(View v) {
new LongOperation().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public void clearValue(View v) {
TextView tv = (TextView)findViewById(R.id.textView2);
tv.setText("CLEARED");
}
Thread Code
24
private class LongOperation extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
int sum=0;
for (int i=0;i<10000;i++)
for (int j=0;j<10000;j++)
sum+=i;
return (String.valueOf(sum));
}
@Override
protected void onPostExecute(String result) {
TextView txt = (TextView) findViewById(R.id.textView2);
txt.setText(result);
}
}
The Threading Picture for 10 key presses
25
5 threads created
and each one
handling 2 key
presses
The Threading Picture for 15 key presses
26
ARM DS-5 on Nvidia Shield - for 10 key presses
27
28
Observation
There are 5 worker threads
Each one gets a piece of work in a round robin fashion
Did the thread really terminate right after the last key press ?
No – there were no samples from the thread
• Shield has two cores active while venue has only one core active
• Due to the OS scheduler
Communicating Threads
29
Communication Pattern
Thread1
Thread2
bqt2
bqt1
busy
sleeptime
Communicating Threads
31
public void showValue(View v) {
bqt1 = new LinkedBlockingQueue<String>(2);
bqt2 = new LinkedBlockingQueue<String>(2);
new Thread1().executeOnExecutor(AsyncTask. THREAD_POOL_EXECUTOR);
new Thread2().executeOnExecutor(AsyncTask. THREAD_POOL_EXECUTOR);
}
public void clearValue(View v) {
TextView tv = (TextView)findViewById(R.id.textView2);
tv.setText("");
}
Output from thread2
Output from thread1
Thread Code
32
private class Thread1 extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
int sum=0;
for (int times=0;times<5;times++)
{
for (int i=0;i<10000;i++)
for (int j=0;j<10000;j++)
sum+=i;
try
{ bqt2.put("1"); }
catch (InterruptedException intEx)
{ System.out.println("Interrupted! "); }
try
{ bqt1.take(); }
catch (InterruptedException intEx)
{ System.out.println("Interrupted!"); }
}
return (String.valueOf(sum));
}
@Override
protected void onPostExecute(String result) {
TextView txt = (TextView) findViewById(R.id.textView2);
txt.setText(txt.getText() + " t1:" + result);
}
private class Thread2 extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
int sum=0;
for (int times=0;times<5;times++)
{
try
{ bqt2.take(); }
catch (InterruptedException intEx)
{ System.out.println("Interrupted! "); }
for (int i=0;i<10000;i++)
for (int j=0;j<10000;j++)
sum+=i;
try
{ bqt1.put("1"); }
catch (InterruptedException intEx)
{ System.out.println("Interrupted! "); }
}
return (String.valueOf(sum));
}
@Override
protected void onPostExecute(String result) {
TextView txt = (TextView) findViewById(R.id.textView2);
txt.setText(txt.getText() + " t2:" + result);
}
The Threading Picture for 5 key presses
33
Alternating
Thread1 &
Thread2
Zoomed in view
34
35
Observation
There are 5 worker threads
Two worker threads are selected from the pool to do the work for each key press
Simultaneously Executing Threads
36
Communication Pattern
Thread1
Thread2
busy
sleeptime
Main thread
Communicating Threads
38
public void showValue(View v) {
new MasterThread().execute();
}
public void clearValue(View v) {
TextView tv = (TextView)findViewById(R.id.textView2);
tv.setText("");
}
5tuples - <Output from thread1, output from thread2>
Thread Code
39
private class MasterThread extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
String result="";
for (int i=0;i<5;i++)
{
AsyncTask<String,Void,String> t1 = new SlaveThread().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
AsyncTask<String,Void,String> t2 = new SlaveThread().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
String res1 = null;
try { res1 = t1.get(); }
catch (InterruptedException e) { e.printStackTrace(); }
catch (ExecutionException e) { e.printStackTrace(); }
String res2 = null;
try { res2 = t2.get(); }
catch (InterruptedException e) { e.printStackTrace(); }
catch (ExecutionException e) { e.printStackTrace(); }
result = result + ":" + res1 + "," + res2;
}
return (result);
}
@Override
protected void onPostExecute(String result) {
TextView txt = (TextView) findViewById(R.id.textView2);
txt.setText(result);
}
}
The Threading Picture for two key presses
40
Thread1 &
Thread2 executing
At same time
41
Observation
When threads execute at same time then cores are being effectively utilized
Better performance
We want this to happen in a multi-core system
Free running threads without any synchronization should preferably be scheduled on
different cores
Some times OS scheduler may not do so
Lazy Threads
42
Communication Pattern
Thread1
busy
sleep
time
3s 3s 3s 3s
Lazy Thread
44
public void showValue(View v) {
new Thread().execute(“”);
}
public void clearValue(View v) {
TextView tv = (TextView)findViewById(R.id.textView2);
tv.setText("");
}
Thread Code
45
private class Thread extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
int sum=0;
for (int i=0;i<5;i++)
{
try {
synchronized (this) {
wait(3000); // wait for 3sec
}
} catch (InterruptedException e) {
e.printStackTrace();
}
for (int j=0;j<10000;j++)
for (int k=0;k<10000;k++)
sum+=i;
}
return (String.valueOf(sum));
}
@Override
protected void onPostExecute(String result) {
TextView txt = (TextView) findViewById(R.id.textView2);
txt.setText(result);
}
}
Performance view
46
Thread slept
For 3 sec
47
Observation
When threads are sleeping they are doing for the right reason
Sleeping threads are good for power/energy consumption
Frequent sleep/wakeups are bad for power/energy consumption
False Sharing
48
What is False Sharing ?
struct {
int x;
int y;
} v;
/* sum & inc run in parallel */
int sum(void)
{
int i, s = 0;
int i;
for (i = 0; i < 1000000; ++i)
s+=v.x;
return s;
}
void inc(void)
{
int i;
for (i = 0; i < 10000000; ++i)
v.y++;
}
v.x v.y
sum inc
cache cache
memory
v.x v.y
Core 1 Core 2
Is there “True” Sharing ?
struct {
int x;
int y;
} v;
/* sum & inc run in parallel */
int sum(void)
{
int i, s = 0;
int i;
for (i = 0; i < 1000000; ++i)
s+=v.x;
return s;
}
void inc(void)
{
int i;
for (i = 0; i < 10000000; ++i)
v.x++;
}
v.x
sum inc
cache cache
memory
v.x v.x
Core 1 Core 2
v.y
False Sharing App
51
public void showValue1(View v) {
for (int i=0;i<256;i++)
a[i]=0;
for (int i=0;i<4;i++)
new Thread().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, String.valueOf(i));
}
// No False Sharing
public void showValue2(View v) {
for (int i=0;i<256;i++)
a[i]=0;
for (int i=0;i<4;i++)
new Thread().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, String.valueOf(i*64));
}
Thread Body
52
private class Thread extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
int tid=Integer.parseInt(params[0]);
int lim = tid+32;
for (int j=0;j<1000;j++)
for (int k=0;k<10000;k++)
for (int i=tid;i<lim;i+=4)
a[i]=a[i]+1;
return (params[0]);
}
@Override
protected void onPostExecute(String result) {
TextView txt = (TextView) findViewById(R.id.textView2);
txt.setText(txt.getText() + " " + result + ":" + a[Integer.parseInt(result)]);
}
}
Memory Access Pattern of Threads
1 2 3 4 1 2 3 4cacheline
1 1
2 2
3 3
4 4
cacheline
cacheline
cacheline
cacheline
False Sharing
No False Sharing
In both cases same amount of work is done
Sample App
54
Click falseS Click NfalseS
Profile of the run
No False sharing
False Sharing
Detailed view
56
False Sharing No False Sharing
Same number of instructions executed
57
Observation
Know the architecture of your platform
Pay attention to the memory access patterns inside your threads
Make sure caches are effectively utilized
Data structures can be rearranged to avoid false sharing
Conclusion
58
A good performance tool can show what exactly is going on in your platform
Sample programs give you a good idea about your platform
Different platforms behave differently
Make sure you run your examples and observe the differences between them
Android has complicated threading model
Make sure you understand it properly
Intel® Developer Zone
• Free tools and code samples
• Technical articles, forums and tutorials
• Connect with Intel and industry experts
• Get development support
• Build relationships
Tools. Knowledge. Community.Tools. Knowledge. Community.
software.intel.com
INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL
PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such
as SYSmark and MobileMark, are measured using specific computer systems, components, software, operations and functions. Any change to any of
those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your
contemplated purchases, including the performance of that product when combined with other products.
Copyright © 2013, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and other countries.
Optimization Notice
Intel’s compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel
microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the
availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent
optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are
reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific
instruction sets covered by this notice.
Notice revision #20110804
Legal Disclaimer & Optimization NoticeLegal Disclaimer & Optimization NoticeLegal Disclaimer & Optimization NoticeLegal Disclaimer & Optimization Notice
Copyright© 2013, Intel Corporation. All rights reserved.
*Other brands and names are the property of their respective owners.
60
eventmobi.com/adcbostoneventmobi.com/adcbostoneventmobi.com/adcbostoneventmobi.com/adcboston
Please take a moment to fill out
the class feedback form via the
app. Paper feedback forms are
also available in the back of the
room.

More Related Content

What's hot

PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesAndrey Karpov
 
The art of reverse engineering flash exploits
The art of reverse engineering flash exploitsThe art of reverse engineering flash exploits
The art of reverse engineering flash exploitsPriyanka Aash
 
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...Asuka Nakajima
 
Deterministic simulation testing
Deterministic simulation testingDeterministic simulation testing
Deterministic simulation testingFoundationDB
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsAsuka Nakajima
 
Kernel-Level Programming: Entering Ring Naught
Kernel-Level Programming: Entering Ring NaughtKernel-Level Programming: Entering Ring Naught
Kernel-Level Programming: Entering Ring NaughtDavid Evans
 
chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)It Academy
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189Mahmoud Samir Fayed
 
Deuce STM - CMP'09
Deuce STM - CMP'09Deuce STM - CMP'09
Deuce STM - CMP'09Guy Korland
 
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDKEric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDKGuardSquare
 
The Ring programming language version 1.2 book - Part 84 of 84
The Ring programming language version 1.2 book - Part 84 of 84The Ring programming language version 1.2 book - Part 84 of 84
The Ring programming language version 1.2 book - Part 84 of 84Mahmoud Samir Fayed
 
JVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's TricksJVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's TricksDoug Hawkins
 
Mutate and Test your Tests
Mutate and Test your TestsMutate and Test your Tests
Mutate and Test your TestsSTAMP Project
 
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)Pujana Paliyawan
 
The Ring programming language version 1.2 book - Part 82 of 84
The Ring programming language version 1.2 book - Part 82 of 84The Ring programming language version 1.2 book - Part 82 of 84
The Ring programming language version 1.2 book - Part 82 of 84Mahmoud Samir Fayed
 

What's hot (20)

Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error Examples
 
The art of reverse engineering flash exploits
The art of reverse engineering flash exploitsThe art of reverse engineering flash exploits
The art of reverse engineering flash exploits
 
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
 
Deterministic simulation testing
Deterministic simulation testingDeterministic simulation testing
Deterministic simulation testing
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
 
Kernel-Level Programming: Entering Ring Naught
Kernel-Level Programming: Entering Ring NaughtKernel-Level Programming: Entering Ring Naught
Kernel-Level Programming: Entering Ring Naught
 
chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)chap 7 : Threads (scjp/ocjp)
chap 7 : Threads (scjp/ocjp)
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84
 
The walking 0xDEAD
The walking 0xDEADThe walking 0xDEAD
The walking 0xDEAD
 
The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189The Ring programming language version 1.6 book - Part 184 of 189
The Ring programming language version 1.6 book - Part 184 of 189
 
Deuce STM - CMP'09
Deuce STM - CMP'09Deuce STM - CMP'09
Deuce STM - CMP'09
 
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDKEric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
Eric Lafortune - ProGuard: Optimizer and obfuscator in the Android SDK
 
The Ring programming language version 1.2 book - Part 84 of 84
The Ring programming language version 1.2 book - Part 84 of 84The Ring programming language version 1.2 book - Part 84 of 84
The Ring programming language version 1.2 book - Part 84 of 84
 
JVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's TricksJVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's Tricks
 
Memory model
Memory modelMemory model
Memory model
 
Mutate and Test your Tests
Mutate and Test your TestsMutate and Test your Tests
Mutate and Test your Tests
 
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
 
Process management
Process managementProcess management
Process management
 
The Ring programming language version 1.2 book - Part 82 of 84
The Ring programming language version 1.2 book - Part 82 of 84The Ring programming language version 1.2 book - Part 82 of 84
The Ring programming language version 1.2 book - Part 82 of 84
 

Similar to Tools and Techniques for Understanding Threading Behavior in Android

Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
 
Building High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortBuilding High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortStefan Marr
 
Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Yulia Tsisyk
 
State of the .Net Performance
State of the .Net PerformanceState of the .Net Performance
State of the .Net PerformanceCUSTIS
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindAndreas Czakaj
 
How to be a smart contract engineer
How to be a smart contract engineerHow to be a smart contract engineer
How to be a smart contract engineerOded Noam
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -evechiportal
 
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2Stanley Ho
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityBrendan Gregg
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DMithun Hunsur
 

Similar to Tools and Techniques for Understanding Threading Behavior in Android (20)

Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
分散式系統
分散式系統分散式系統
分散式系統
 
Building High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low EffortBuilding High-Performance Language Implementations With Low Effort
Building High-Performance Language Implementations With Low Effort
 
Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"
 
State of the .Net Performance
State of the .Net PerformanceState of the .Net Performance
State of the .Net Performance
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mind
 
TiReX: Tiled Regular eXpression matching architecture
TiReX: Tiled Regular eXpression matching architectureTiReX: Tiled Regular eXpression matching architecture
TiReX: Tiled Regular eXpression matching architecture
 
How to be a smart contract engineer
How to be a smart contract engineerHow to be a smart contract engineer
How to be a smart contract engineer
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2
 
Thread 1
Thread 1Thread 1
Thread 1
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 
Iron python
Iron pythonIron python
Iron python
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
Getting Input from User
Getting Input from UserGetting Input from User
Getting Input from User
 
Unit-2 Getting Input from User.pptx
Unit-2 Getting Input from User.pptxUnit-2 Getting Input from User.pptx
Unit-2 Getting Input from User.pptx
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in D
 
#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG
 

More from Intel® Software

AI for All: Biology is eating the world & AI is eating Biology
AI for All: Biology is eating the world & AI is eating Biology AI for All: Biology is eating the world & AI is eating Biology
AI for All: Biology is eating the world & AI is eating Biology Intel® Software
 
Python Data Science and Machine Learning at Scale with Intel and Anaconda
Python Data Science and Machine Learning at Scale with Intel and AnacondaPython Data Science and Machine Learning at Scale with Intel and Anaconda
Python Data Science and Machine Learning at Scale with Intel and AnacondaIntel® Software
 
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSci
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSciStreamline End-to-End AI Pipelines with Intel, Databricks, and OmniSci
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSciIntel® Software
 
AI for good: Scaling AI in science, healthcare, and more.
AI for good: Scaling AI in science, healthcare, and more.AI for good: Scaling AI in science, healthcare, and more.
AI for good: Scaling AI in science, healthcare, and more.Intel® Software
 
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...Intel® Software
 
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...Intel® Software
 
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...Intel® Software
 
AWS & Intel Webinar Series - Accelerating AI Research
AWS & Intel Webinar Series - Accelerating AI ResearchAWS & Intel Webinar Series - Accelerating AI Research
AWS & Intel Webinar Series - Accelerating AI ResearchIntel® Software
 
Intel AIDC Houston Summit - Overview Slides
Intel AIDC Houston Summit - Overview SlidesIntel AIDC Houston Summit - Overview Slides
Intel AIDC Houston Summit - Overview SlidesIntel® Software
 
AIDC NY: BODO AI Presentation - 09.19.2019
AIDC NY: BODO AI Presentation - 09.19.2019AIDC NY: BODO AI Presentation - 09.19.2019
AIDC NY: BODO AI Presentation - 09.19.2019Intel® Software
 
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019Intel® Software
 
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...Intel® Software
 
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...Intel® Software
 
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...Intel® Software
 
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...Intel® Software
 
AIDC India - Intel Movidius / Open Vino Slides
AIDC India - Intel Movidius / Open Vino SlidesAIDC India - Intel Movidius / Open Vino Slides
AIDC India - Intel Movidius / Open Vino SlidesIntel® Software
 
AIDC India - AI Vision Slides
AIDC India - AI Vision SlidesAIDC India - AI Vision Slides
AIDC India - AI Vision SlidesIntel® Software
 
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...Intel® Software
 

More from Intel® Software (20)

AI for All: Biology is eating the world & AI is eating Biology
AI for All: Biology is eating the world & AI is eating Biology AI for All: Biology is eating the world & AI is eating Biology
AI for All: Biology is eating the world & AI is eating Biology
 
Python Data Science and Machine Learning at Scale with Intel and Anaconda
Python Data Science and Machine Learning at Scale with Intel and AnacondaPython Data Science and Machine Learning at Scale with Intel and Anaconda
Python Data Science and Machine Learning at Scale with Intel and Anaconda
 
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSci
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSciStreamline End-to-End AI Pipelines with Intel, Databricks, and OmniSci
Streamline End-to-End AI Pipelines with Intel, Databricks, and OmniSci
 
AI for good: Scaling AI in science, healthcare, and more.
AI for good: Scaling AI in science, healthcare, and more.AI for good: Scaling AI in science, healthcare, and more.
AI for good: Scaling AI in science, healthcare, and more.
 
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...
Software AI Accelerators: The Next Frontier | Software for AI Optimization Su...
 
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...
Advanced Techniques to Accelerate Model Tuning | Software for AI Optimization...
 
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
Reducing Deep Learning Integration Costs and Maximizing Compute Efficiency| S...
 
AWS & Intel Webinar Series - Accelerating AI Research
AWS & Intel Webinar Series - Accelerating AI ResearchAWS & Intel Webinar Series - Accelerating AI Research
AWS & Intel Webinar Series - Accelerating AI Research
 
Intel Developer Program
Intel Developer ProgramIntel Developer Program
Intel Developer Program
 
Intel AIDC Houston Summit - Overview Slides
Intel AIDC Houston Summit - Overview SlidesIntel AIDC Houston Summit - Overview Slides
Intel AIDC Houston Summit - Overview Slides
 
AIDC NY: BODO AI Presentation - 09.19.2019
AIDC NY: BODO AI Presentation - 09.19.2019AIDC NY: BODO AI Presentation - 09.19.2019
AIDC NY: BODO AI Presentation - 09.19.2019
 
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019
AIDC NY: Applications of Intel AI by QuEST Global - 09.19.2019
 
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...
Advanced Single Instruction Multiple Data (SIMD) Programming with Intel® Impl...
 
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
Build a Deep Learning Video Analytics Framework | SIGGRAPH 2019 Technical Ses...
 
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...
Bring Intelligent Motion Using Reinforcement Learning Engines | SIGGRAPH 2019...
 
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
RenderMan*: The Role of Open Shading Language (OSL) with Intel® Advanced Vect...
 
AIDC India - AI on IA
AIDC India  - AI on IAAIDC India  - AI on IA
AIDC India - AI on IA
 
AIDC India - Intel Movidius / Open Vino Slides
AIDC India - Intel Movidius / Open Vino SlidesAIDC India - Intel Movidius / Open Vino Slides
AIDC India - Intel Movidius / Open Vino Slides
 
AIDC India - AI Vision Slides
AIDC India - AI Vision SlidesAIDC India - AI Vision Slides
AIDC India - AI Vision Slides
 
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...
Enhance and Accelerate Your AI and Machine Learning Solution | SIGGRAPH 2019 ...
 

Recently uploaded

Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 

Recently uploaded (20)

Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 

Tools and Techniques for Understanding Threading Behavior in Android

  • 1. Tools and Techniques for Understanding Threading Behavior in Android* Dr. Ramesh Peri Sr. Principal Engineer & Architect of Android tools Intel Corporation Austin, TX 78746 Email: ramesh.v.peri@intel.com
  • 2. 2 Agenda Goals Tools Roundup Intel® VtuneTM, Linux Perf, Nvidia* System Profiler, Google* Systrace, ARM* DS-5 Threading Examples Simple Example Simple Threading Communicating Threads Simultaneously executing threads Lazy Thread False Sharing
  • 3. 3 Goals Learn about performance analysis tools in Android Develop simple micro-benchmarks and run them under the control of a performance analysis tool Interpret and validate the data Understand Threading models used in Android Core to thread mapping Has Impact on – responsiveness – power and – performance
  • 9. Tools 9 Feature Vtune Linux Perf Nivida System Profiler Google Systrace ARM DS-5 OTB Experience Hard Hard Hard Easy Hard TimeLine Yes No No Yes Yes Java Source Yes Limited No No Maybe Gridview(HotSpot) Yes Yes Yes No Yes h/w events Yes Limited Limited No Yes OS events Limited Yes Limited Yes Yes Filtering Yes No No No No Grouping Yes Limited No No Limited Call Stack Yes Yes Yes No Yes Platform View Yes No No No Limited
  • 10. Devices 10 Nexus 7 Dell Venue 8 Nvidia Shield Processor Snapdragon S4 CLTP/Merrifield Tegra K1 Frequency 1.5Ghz 1.3Ghz 2.2Ghz Memory 2 1 2 Number of Cores 4 2 4 Android Version 4.3 4.3 4.4 Storage 32 16 32 Manufacturer Qualcomm Intel Nvidia Display 1920x1200 1920x1200 1920x1200
  • 11. Device Resources 11 Dell Venue 8 http://software.intel.com/mdk http://opensource.dell.com Nvidia Shield https://developer.nvidia.com/develop4shield Nexus 7 http://play.google.com
  • 13. A Simple Example 13 public void showValue(View v) { int i, j, sum=0; for (i=0;i<10000;i++) for (j=0;j<10000;j++) sum+=i; TextView tv = (TextView)findViewById(R.id.textView2); tv.setText(String.valueOf(sum)); } public void clearValue(View v) { TextView tv = (TextView)findViewById(R.id.textView2); tv.setText(""); } textview2
  • 14. Performance Profile 14 Timeline Gives you the birds eye-view of overall execution GridView
  • 15. Data Grouping 15 Mostly using core 1 Allows you to look at data in multiple ways
  • 16. Filtering 16 Second press used Core 0 Mouse right button click Lets you focus on specific events in the execution
  • 17. Java Source to Assembly Mapping 17 The hot loop Jit asm to source java correlation The hot loop in assembly Requires support in the Dalvik/Art runtime
  • 18. Arm Streamline on Nvidia Shield 18 Two cores active
  • 19. Systrace on Nvidia Shield for 6 key presses 19
  • 20. Nvidia System Profiler on Nvidia Shield 20 TimeLine Grid view with callstacks Zoom and Filter
  • 21. 21 Observation All key presses are handled by one thread The thread is mapped to different cores at different times Core 1 is handling most of the work in the application for venue8 Core 0 and core 1 are active on Nvidia shield Core 1 is doing the compute and core 0 seems to be active with the OS and another process
  • 23. Simple Threading 23 public void showValue(View v) { new LongOperation().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } public void clearValue(View v) { TextView tv = (TextView)findViewById(R.id.textView2); tv.setText("CLEARED"); }
  • 24. Thread Code 24 private class LongOperation extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { int sum=0; for (int i=0;i<10000;i++) for (int j=0;j<10000;j++) sum+=i; return (String.valueOf(sum)); } @Override protected void onPostExecute(String result) { TextView txt = (TextView) findViewById(R.id.textView2); txt.setText(result); } }
  • 25. The Threading Picture for 10 key presses 25 5 threads created and each one handling 2 key presses
  • 26. The Threading Picture for 15 key presses 26
  • 27. ARM DS-5 on Nvidia Shield - for 10 key presses 27
  • 28. 28 Observation There are 5 worker threads Each one gets a piece of work in a round robin fashion Did the thread really terminate right after the last key press ? No – there were no samples from the thread • Shield has two cores active while venue has only one core active • Due to the OS scheduler
  • 31. Communicating Threads 31 public void showValue(View v) { bqt1 = new LinkedBlockingQueue<String>(2); bqt2 = new LinkedBlockingQueue<String>(2); new Thread1().executeOnExecutor(AsyncTask. THREAD_POOL_EXECUTOR); new Thread2().executeOnExecutor(AsyncTask. THREAD_POOL_EXECUTOR); } public void clearValue(View v) { TextView tv = (TextView)findViewById(R.id.textView2); tv.setText(""); } Output from thread2 Output from thread1
  • 32. Thread Code 32 private class Thread1 extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { int sum=0; for (int times=0;times<5;times++) { for (int i=0;i<10000;i++) for (int j=0;j<10000;j++) sum+=i; try { bqt2.put("1"); } catch (InterruptedException intEx) { System.out.println("Interrupted! "); } try { bqt1.take(); } catch (InterruptedException intEx) { System.out.println("Interrupted!"); } } return (String.valueOf(sum)); } @Override protected void onPostExecute(String result) { TextView txt = (TextView) findViewById(R.id.textView2); txt.setText(txt.getText() + " t1:" + result); } private class Thread2 extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { int sum=0; for (int times=0;times<5;times++) { try { bqt2.take(); } catch (InterruptedException intEx) { System.out.println("Interrupted! "); } for (int i=0;i<10000;i++) for (int j=0;j<10000;j++) sum+=i; try { bqt1.put("1"); } catch (InterruptedException intEx) { System.out.println("Interrupted! "); } } return (String.valueOf(sum)); } @Override protected void onPostExecute(String result) { TextView txt = (TextView) findViewById(R.id.textView2); txt.setText(txt.getText() + " t2:" + result); }
  • 33. The Threading Picture for 5 key presses 33 Alternating Thread1 & Thread2
  • 35. 35 Observation There are 5 worker threads Two worker threads are selected from the pool to do the work for each key press
  • 38. Communicating Threads 38 public void showValue(View v) { new MasterThread().execute(); } public void clearValue(View v) { TextView tv = (TextView)findViewById(R.id.textView2); tv.setText(""); } 5tuples - <Output from thread1, output from thread2>
  • 39. Thread Code 39 private class MasterThread extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { String result=""; for (int i=0;i<5;i++) { AsyncTask<String,Void,String> t1 = new SlaveThread().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); AsyncTask<String,Void,String> t2 = new SlaveThread().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); String res1 = null; try { res1 = t1.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } String res2 = null; try { res2 = t2.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } result = result + ":" + res1 + "," + res2; } return (result); } @Override protected void onPostExecute(String result) { TextView txt = (TextView) findViewById(R.id.textView2); txt.setText(result); } }
  • 40. The Threading Picture for two key presses 40 Thread1 & Thread2 executing At same time
  • 41. 41 Observation When threads execute at same time then cores are being effectively utilized Better performance We want this to happen in a multi-core system Free running threads without any synchronization should preferably be scheduled on different cores Some times OS scheduler may not do so
  • 44. Lazy Thread 44 public void showValue(View v) { new Thread().execute(“”); } public void clearValue(View v) { TextView tv = (TextView)findViewById(R.id.textView2); tv.setText(""); }
  • 45. Thread Code 45 private class Thread extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { int sum=0; for (int i=0;i<5;i++) { try { synchronized (this) { wait(3000); // wait for 3sec } } catch (InterruptedException e) { e.printStackTrace(); } for (int j=0;j<10000;j++) for (int k=0;k<10000;k++) sum+=i; } return (String.valueOf(sum)); } @Override protected void onPostExecute(String result) { TextView txt = (TextView) findViewById(R.id.textView2); txt.setText(result); } }
  • 47. 47 Observation When threads are sleeping they are doing for the right reason Sleeping threads are good for power/energy consumption Frequent sleep/wakeups are bad for power/energy consumption
  • 49. What is False Sharing ? struct { int x; int y; } v; /* sum & inc run in parallel */ int sum(void) { int i, s = 0; int i; for (i = 0; i < 1000000; ++i) s+=v.x; return s; } void inc(void) { int i; for (i = 0; i < 10000000; ++i) v.y++; } v.x v.y sum inc cache cache memory v.x v.y Core 1 Core 2
  • 50. Is there “True” Sharing ? struct { int x; int y; } v; /* sum & inc run in parallel */ int sum(void) { int i, s = 0; int i; for (i = 0; i < 1000000; ++i) s+=v.x; return s; } void inc(void) { int i; for (i = 0; i < 10000000; ++i) v.x++; } v.x sum inc cache cache memory v.x v.x Core 1 Core 2 v.y
  • 51. False Sharing App 51 public void showValue1(View v) { for (int i=0;i<256;i++) a[i]=0; for (int i=0;i<4;i++) new Thread().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, String.valueOf(i)); } // No False Sharing public void showValue2(View v) { for (int i=0;i<256;i++) a[i]=0; for (int i=0;i<4;i++) new Thread().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, String.valueOf(i*64)); }
  • 52. Thread Body 52 private class Thread extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { int tid=Integer.parseInt(params[0]); int lim = tid+32; for (int j=0;j<1000;j++) for (int k=0;k<10000;k++) for (int i=tid;i<lim;i+=4) a[i]=a[i]+1; return (params[0]); } @Override protected void onPostExecute(String result) { TextView txt = (TextView) findViewById(R.id.textView2); txt.setText(txt.getText() + " " + result + ":" + a[Integer.parseInt(result)]); } }
  • 53. Memory Access Pattern of Threads 1 2 3 4 1 2 3 4cacheline 1 1 2 2 3 3 4 4 cacheline cacheline cacheline cacheline False Sharing No False Sharing In both cases same amount of work is done
  • 54. Sample App 54 Click falseS Click NfalseS
  • 55. Profile of the run No False sharing False Sharing
  • 56. Detailed view 56 False Sharing No False Sharing Same number of instructions executed
  • 57. 57 Observation Know the architecture of your platform Pay attention to the memory access patterns inside your threads Make sure caches are effectively utilized Data structures can be rearranged to avoid false sharing
  • 58. Conclusion 58 A good performance tool can show what exactly is going on in your platform Sample programs give you a good idea about your platform Different platforms behave differently Make sure you run your examples and observe the differences between them Android has complicated threading model Make sure you understand it properly
  • 59. Intel® Developer Zone • Free tools and code samples • Technical articles, forums and tutorials • Connect with Intel and industry experts • Get development support • Build relationships Tools. Knowledge. Community.Tools. Knowledge. Community. software.intel.com
  • 60. INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific computer systems, components, software, operations and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products. Copyright © 2013, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and other countries. Optimization Notice Intel’s compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804 Legal Disclaimer & Optimization NoticeLegal Disclaimer & Optimization NoticeLegal Disclaimer & Optimization NoticeLegal Disclaimer & Optimization Notice Copyright© 2013, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 60
  • 61. eventmobi.com/adcbostoneventmobi.com/adcbostoneventmobi.com/adcbostoneventmobi.com/adcboston Please take a moment to fill out the class feedback form via the app. Paper feedback forms are also available in the back of the room.