Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ②...

21
// Profiling Basics Guest Lecture Nina & Stephen | [email protected]

Transcript of Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ②...

Page 1: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

//

Profiling Basics

Guest Lecture

Nina & Stephen | [email protected]

Page 2: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Nina Vyedin§  Product Manager at Xamarin §  Working on Profiler (and a few

other things...)§  Xamarin Boston office

Who We Are

Page 3: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Stephen Shaw§  Developer at Xamarin§  Working on the Profiler§  Xamarin Utah Remote Office

Who We Are

Page 4: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Introduction to profiling: §  What it is, when to use it, how

to do it right

v  Tools we use for profiling:§  Native§  Xamarin§  3rd party

What We’ll Cover

Page 5: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

What We Won’t Coverv  How to solve your particular

memory or performance problems§  Contact support

v  Feedback on Xamarin Profiler§  Email [email protected]§  Forum

http://tinyurl.com/XamProfilerv  Bugs?

§  https://bugzilla.xamarin.com

Page 6: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

What, Why, When

Intro to Profiling

Page 7: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Gathering data about your app while it’s running

v  Instrument the code to see what’s going on inside

v  Get information about resource usage

What is Profiling?

Page 8: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

Why do we Profile?v  We don’t write perfect codev  Our tools aren’t perfect

§  Issues with frameworks§  Issues with bindings

v  Fewer resources on mobile§  Memory§  CPU

Page 9: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Solve problems §  During development§  Diagnose a hang or blocker

v  Deliver a good experience§  Polish before shipping§  Optimize

When do we Profile?

Page 10: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Profile simple C# appv  Memory Profilingv  Performance Profiling

Demo: Profile .NET Code

Page 11: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

①  What is memory profiling?②  What is performance profiling?③  When is the best time to profile an application?

Quiz

Page 12: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

Native & Xamarin

Profiling Tools

Page 13: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Profilers for native apps:§  Apple Instruments, Android

Monitorv  Useful for issues [on native side?]v  Not useful for issues in managed

code

Native Profiling Tools

Page 14: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Allocations§  Call tree

v  Time Profiler

Demo: Instruments

Page 15: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Android/Google profiling toolv  Useful in a few scenarios:

§  Network usage§  Bitmaps

v  Gets information about Java side, but not mono side

Demo: Monitor

Page 16: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Xamarin Profiler for Mac§  Profile iOS, Android, Mac apps

v  Xamarin Profiler for Windows§  Profile Android apps

v  Profiles managed (mono) code

http://www.xamarin.com/profiler

Xamarin Profiler

Page 17: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

Xamarin Profiler

v  File format called Mono Log Profiler Data (mlpd)

v  Command line version documented here:

http://www.mono-project.com/docs/debug+profile/profile/profiler/

Page 18: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Install profilerv  Launch from Xamarin Studiov  Allocationsv  Time Profilerv  Call tree & backtracev  Snapshot comparev  File > Save

Demo: Profile iOS

Page 19: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Launch form Visual Studiov  Take snapshotsv  Allocationsv  Time Profilerv  Call tree & backtracev  Snapshot compare

Demo: Profile Android

Page 20: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

v  Use best practices§  http://tinyurl.com/

XamMemoryBestPracticesv  Profiling is detective work - don’t

rely on tools alonev  Play with Xamarin Profilerv  Get in touch!

[email protected]

Final Thoughts

Page 21: Profiling - Microsoftxamarinuniversity.blob.core.windows.net/guestlectures/Profiling.pdf · ② What is performance profiling? ③ When is the best time to profile an application?

Thank You!Please complete the class survey in your profile: university.xamarin.com/profile

//

Profiling Basics

Guest Lecture