SlideShare a Scribd company logo
1 of 26
Download to read offline
Visual Studio Profiler
let’s start a profiling session !
Maxime Lemaitre – 23/07/2013
Profiling
Tools
• Let developers measure, evaluate, and target performance-related
issues in their code
– CPU, Memory, Concurrency, ADO.NET…
• Command-line tools but fully integrated into the IDE
• Since VS 2012, available in Pro Version
• Really powerful tools but poorly documented/blogged
• Needs knowledge on the application and on .net framework
Introduction on MSDN
2
Profiling Tools Introduction
Here is the general process :
• Configure the performance session by specifying
the profiling method and the data that you want
to collect.
• Collect profiling data by running the application
in the performance session.
• Analyze the data to identify the performance
issue.
• Modify code with the goal to increases the
application performance of the code
• Collect profiling data on the changed code, and
compare the profiling data of the original and
changed data.
• Generate a report that documents the increase in
performance.
3
Profiling Workflow
There are 4 profiling available methods
• CPU Sampling
– Collects application statistics that are useful for
initial analysis and for analyzing CPU utilization
issues.
• Instrumentation
– Collects detailed timing data that are useful for
focused analysis and for analyzing input/output
performance issues.
• .NET Memory Allocation
– Collects .NET Framework memory allocation
data by using the sampling profiling method.
• Concurrency
– Collects numeric resource contention data.
4
Choosing a Profiling Method
Can be attached to
a running process !
The sampling profiling method of the Profiling Tools interrupts the computer processor at
set intervals and collects the function call stack.
The profiler analysis determines whether the processor is executing code in the target
process. If the processor is not executing code in the target process, the sample is
discarded.
• Inclusive samples
– The total number of samples that are collected during the execution of the target function.
– This includes samples that are collected during the direct execution of the function code and
samples that are collected during the execution of child functions that are called by the target
function.
• Exclusive samples
– The number of samples that are collected during the direct execution of the instructions of
the target function.
– Exclusive samples do not include samples that are collected during the execution of
functions that are called by the target function.
• Inclusive percent
• Exclusive percent
5
Sampling Profiling Method
Too Many Samples ?
- Slow piece of code
- Too many calls to a piece of code
=> For sure, there is something to optimize
The instrumentation profiling method of the Profiling Tools records detailed timing
information for the function calls, lines, and instructions in the profiled application
The instrumentation method injects code at the start and end of target functions in the
profiled binary, and before and after each call by those functions to other functions. The
injected code records interval between collects and OS operations.
• Elapsed Inclusive values
– The total time that was spent executing a function and its child functions.
• Elapsed Exclusive values
– The time that was spent executing a function, excluding time that was spent in child
functions.
• Application Inclusive values
– The time that was spent executing a function and its child functions, excluding time that was
spent in operating system events.
• Application Exclusive values
– The time that was spent executing a function, excluding the time that was spent in child
functions and the time that was spent in operating system events.
• Elapsed Inclusive & Exclusive percent
• Application Inclusive & Exclusive percent 6
Instrumentation Profiling Method
The .NET memory allocation profiling method of Profiling Tools collects information
about the size and number of objects that were created in an allocation or destroyed in a
garbage collection and a few additional information.
The memory profiler interrupts the computer processor at each allocation of a .NET
Framework object in a profiled application. When object lifetime data is also collected, the
profiler interrupts the processor after each .NET Framework garbage collection. The data
is aggregated for each profiled function and for each type of object.
• Allocation Data
– Total counts and sizes of the allocated or destroyed memory objects
• Lifetime Data
– Displays the number and size of the objects and the generation when they are reclaimed
7
Memory Profiling Method
Resource contention profiling collects detailed call stack information each time
competing threads in an application are forced to wait for access to a shared resource.
Resource contention reports display the total number of contentions and the total time
that was spent waiting for a resource for the modules, functions, source code lines, and
instructions in which the waiting occured.
• Inclusive values
– Contentions that were caused by child functions that were called by the function are included
in inclusive values.
• Exclusive values
– Contentions caused by child functions are not included. The exclusive time for the function
also includes only the wait times that were caused by statements in the function body.
8
Concurrency profiling method
• Adds information to a profiling data file about synchronous ADO.NET calls
between an application and a SQL Server database
• Can be added to profiling data that is collected with the sampling,
instrumentation, .NET memory, or concurrency methods
9
Tier Interaction
Hidden profiling method
For example, 1204
requests to the
Casino Home Page
10
Profiling Quick Start
this often begins
with a wizard …
11
Profiling Wizard
Profiling Method Targets
TIP ?
Js ?
• Enables us to configure and start performance sessions
– Created/Filled by Performance Wizard
12
Performance Explorer
Session Name
The name of the session. Right-click the session name
to edit the session properties
Targets
Binaries that are to be profiled in the session. Can be a
binary, a VS project, or Web site. Each target have own
Properties.
Reports
Files that are generated for the session. Right-click a
report name to open, remove, or export a profiler data
file. Can compare two profiler data files.
13
Profiling…
Pause
suspend data collection
Stop profiling
end the profiling session
When profiling you have nothing to do :
- Let is run for standalone app (Console, Test, ..)
- Navigate between pages/forms (Web Site or Desktop)
1 - Hot Path
branch of your application's call tree
that was most active when data was
collected
2 - Functions Doing the Most
Individual Work.
functions with the highest exclusive
samples
3 - Summary Timeline
timeline graph & CPU usage
4 - Error List
uses a set of rules to suggest ways of
improving the profiling run and to
identify possible performance problems
14
Summary View
Summary depends on Profiling method !
There are also a few others Views
of profiling data files are displayed
• Call Tree
• Modules View
• Functions View
• Object Lifetime View
• Thread Details View
• Tier Interaction Views
• …
15
Analysis Results
Demos
16
17
Demo #1
ASP.NET MVC 4 Sample (Magazine website)
Many Samples in Dal code and many calls to the db. Missing cache ?
18
Demo #2
Micro Benchmarking a Translation Helper (in Unit Test)
More than 93% of elapsed time is spent on Regex.Replace …
For sure, there is something to improve in the helper.
19
Demo #3
Task cancellation Helper
For 100 000 tests, 300 000 tasks were allocated. Ouh !
For sure, memory consumption is not optimal when task is already completed.
• Profiling data can be collected through the ASP.NET profiler when we run a
web or a load test
– Limited to sampling and tier interaction data
– Not appropriate for long runs (profiler file can become large …)
• Really powerful if you have real scenarios & test cases
20
Profiling ASP.NET Web & Load Tests
You just have to select
ASP.NET profiler for your test
settings
• Instrumentation profiling can provide a greater level of detail ; this means
that more data is collected and instrumentation is more likely to impact the
performance
• The Visual Studio profiler provides an API for controlling data collection
from within an application
– allow us to limit the amount of data that is collected during a profiling session.
Simply add a reference to ToolsMicrosoft.VisualStudio.Profiler.dll
(VSDirToolsPerformance Tools)
21
Profiler APIs
Right-click a test and choose Profile Test to
run performance analysis on a single unit test
22
Profiling Unit Tests
Since VS 2012 update 2
The test runs as usual followed by
the analysis (sampling method).
When analysis completes, you’ll see
the classic summary view
Questions ?
23
• http://msdn.microsoft.com/en-us/library/ms182372.aspx
• http://msdn.microsoft.com/en-us/library/z9z62c29.aspx
• http://blogs.msdn.com/b/dotnet/archive/2013/04/04/net-memory-allocation-
profiling-with-visual-studio-2012.aspx
• http://blogs.msdn.com/b/anilchandra/archive/2012/09/24/test.aspx
• http://blogs.msdn.com/b/visualstudioalm/archive/tags/diagnostics/
• http://blogs.msdn.com/b/dotnet/archive/2013/04/04/net-memory-allocation-
profiling-with-visual-studio-2012.aspx
24
Appendices & References
Find out more
• On https://techblog.betclicgroup.com/
About Betclic
• Betclic Everest Group, one of the world leaders in online gaming, has a unique
portfolio comprising various complementary international brands: Betclic, Everest
Gaming, bet-at-home.com, Expekt…
• Active in 100 countries with more than 12 million customers worldwide, the Group is
committed to promoting secure and responsible gaming and is a member of several
international professional associations including the EGBA (European Gaming and
Betting Association) and the ESSA (European Sports Security Association).
• Through our brands, Betclic Everest Group places expertise, technological know-how
and security at the heart of our strategy to deliver an on-line gaming offer attuned to
the passion of our players.

More Related Content

What's hot

Natural Language Search with Knowledge Graphs (Activate 2019)
Natural Language Search with Knowledge Graphs (Activate 2019)Natural Language Search with Knowledge Graphs (Activate 2019)
Natural Language Search with Knowledge Graphs (Activate 2019)Trey Grainger
 
200819 NAVER TECH CONCERT 06_놓치기 쉬운 안드로이드 UI 디테일 살펴보기
200819 NAVER TECH CONCERT 06_놓치기 쉬운 안드로이드 UI 디테일 살펴보기200819 NAVER TECH CONCERT 06_놓치기 쉬운 안드로이드 UI 디테일 살펴보기
200819 NAVER TECH CONCERT 06_놓치기 쉬운 안드로이드 UI 디테일 살펴보기NAVER Engineering
 
Competitive analysis for seo
Competitive analysis for seoCompetitive analysis for seo
Competitive analysis for seoJames Brown
 
Quality Content at Scale Through Automated Text Summarization of UGC
Quality Content at Scale Through Automated Text Summarization of UGCQuality Content at Scale Through Automated Text Summarization of UGC
Quality Content at Scale Through Automated Text Summarization of UGCHamlet Batista
 
TechSEO Boost 2021 - Rendering Strategies: Measuring the Devil’s Details in C...
TechSEO Boost 2021 - Rendering Strategies: Measuring the Devil’s Details in C...TechSEO Boost 2021 - Rendering Strategies: Measuring the Devil’s Details in C...
TechSEO Boost 2021 - Rendering Strategies: Measuring the Devil’s Details in C...Catalyst
 
이재훈 개발 포트폴리오.pdf
이재훈 개발 포트폴리오.pdf이재훈 개발 포트폴리오.pdf
이재훈 개발 포트폴리오.pdfjaehoon lee
 
The Semantic Knowledge Graph
The Semantic Knowledge GraphThe Semantic Knowledge Graph
The Semantic Knowledge GraphTrey Grainger
 
Facebook은 React를 왜 만들었을까?
Facebook은 React를 왜 만들었을까? Facebook은 React를 왜 만들었을까?
Facebook은 React를 왜 만들었을까? Kim Hunmin
 
Higher Order Components and Render Props
Higher Order Components and Render PropsHigher Order Components and Render Props
Higher Order Components and Render PropsNitish Phanse
 

What's hot (10)

Natural Language Search with Knowledge Graphs (Activate 2019)
Natural Language Search with Knowledge Graphs (Activate 2019)Natural Language Search with Knowledge Graphs (Activate 2019)
Natural Language Search with Knowledge Graphs (Activate 2019)
 
200819 NAVER TECH CONCERT 06_놓치기 쉬운 안드로이드 UI 디테일 살펴보기
200819 NAVER TECH CONCERT 06_놓치기 쉬운 안드로이드 UI 디테일 살펴보기200819 NAVER TECH CONCERT 06_놓치기 쉬운 안드로이드 UI 디테일 살펴보기
200819 NAVER TECH CONCERT 06_놓치기 쉬운 안드로이드 UI 디테일 살펴보기
 
Competitive analysis for seo
Competitive analysis for seoCompetitive analysis for seo
Competitive analysis for seo
 
React introduction
React introductionReact introduction
React introduction
 
Quality Content at Scale Through Automated Text Summarization of UGC
Quality Content at Scale Through Automated Text Summarization of UGCQuality Content at Scale Through Automated Text Summarization of UGC
Quality Content at Scale Through Automated Text Summarization of UGC
 
TechSEO Boost 2021 - Rendering Strategies: Measuring the Devil’s Details in C...
TechSEO Boost 2021 - Rendering Strategies: Measuring the Devil’s Details in C...TechSEO Boost 2021 - Rendering Strategies: Measuring the Devil’s Details in C...
TechSEO Boost 2021 - Rendering Strategies: Measuring the Devil’s Details in C...
 
이재훈 개발 포트폴리오.pdf
이재훈 개발 포트폴리오.pdf이재훈 개발 포트폴리오.pdf
이재훈 개발 포트폴리오.pdf
 
The Semantic Knowledge Graph
The Semantic Knowledge GraphThe Semantic Knowledge Graph
The Semantic Knowledge Graph
 
Facebook은 React를 왜 만들었을까?
Facebook은 React를 왜 만들었을까? Facebook은 React를 왜 만들었을까?
Facebook은 React를 왜 만들었을까?
 
Higher Order Components and Render Props
Higher Order Components and Render PropsHigher Order Components and Render Props
Higher Order Components and Render Props
 

Similar to Visual Studio Profiler

Visual Studio 2013 Profiling
Visual Studio 2013 ProfilingVisual Studio 2013 Profiling
Visual Studio 2013 ProfilingDenis Dudaev
 
_VoicePPT_QA_Testing_Training_4_Days_Schedule.ppt
_VoicePPT_QA_Testing_Training_4_Days_Schedule.ppt_VoicePPT_QA_Testing_Training_4_Days_Schedule.ppt
_VoicePPT_QA_Testing_Training_4_Days_Schedule.pptAnilKumarARS
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsQuontra Solutions
 
Application Performance Tuning Techniques
Application Performance Tuning TechniquesApplication Performance Tuning Techniques
Application Performance Tuning TechniquesRam Nagesh
 
Automation Tool Overview
Automation Tool OverviewAutomation Tool Overview
Automation Tool OverviewANKUR-BA
 
Automation Tools Overview
Automation Tools OverviewAutomation Tools Overview
Automation Tools OverviewSachin-QA
 
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f..." Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...Lohika_Odessa_TechTalks
 
Analysis concepts and principles
Analysis concepts and principlesAnalysis concepts and principles
Analysis concepts and principlessaurabhshertukde
 
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!Richard Robinson
 
Automation Tools Overview
Automation Tools OverviewAutomation Tools Overview
Automation Tools OverviewMurageppa-QA
 
Fundamentals of software development
Fundamentals of software developmentFundamentals of software development
Fundamentals of software developmentPratik Devmurari
 
Se6162 analysis concept and principles
Se6162 analysis concept and principlesSe6162 analysis concept and principles
Se6162 analysis concept and principleskhaerul azmi
 
Performance Testing
Performance TestingPerformance Testing
Performance TestingAnu Shaji
 
Vehicle management system
Vehicle management systemVehicle management system
Vehicle management systemwethecodershelp
 
Vehicle management system
Vehicle management systemVehicle management system
Vehicle management systemWeTheCoders
 
Service quality monitoring system architecture
Service quality monitoring system architectureService quality monitoring system architecture
Service quality monitoring system architectureMatsuo Sawahashi
 

Similar to Visual Studio Profiler (20)

Visual Studio 2013 Profiling
Visual Studio 2013 ProfilingVisual Studio 2013 Profiling
Visual Studio 2013 Profiling
 
_VoicePPT_QA_Testing_Training_4_Days_Schedule.ppt
_VoicePPT_QA_Testing_Training_4_Days_Schedule.ppt_VoicePPT_QA_Testing_Training_4_Days_Schedule.ppt
_VoicePPT_QA_Testing_Training_4_Days_Schedule.ppt
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
 
Application Performance Tuning Techniques
Application Performance Tuning TechniquesApplication Performance Tuning Techniques
Application Performance Tuning Techniques
 
Automation Tool Overview
Automation Tool OverviewAutomation Tool Overview
Automation Tool Overview
 
Automation Tools Overview
Automation Tools OverviewAutomation Tools Overview
Automation Tools Overview
 
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f..." Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
 
Gcs day1
Gcs day1Gcs day1
Gcs day1
 
software engineering
software engineering software engineering
software engineering
 
Analysis concepts and principles
Analysis concepts and principlesAnalysis concepts and principles
Analysis concepts and principles
 
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
SCRIMPS-STD: Test Automation Design Principles - and asking the right questions!
 
Automation Tools Overview
Automation Tools OverviewAutomation Tools Overview
Automation Tools Overview
 
Fundamentals of software development
Fundamentals of software developmentFundamentals of software development
Fundamentals of software development
 
Se6162 analysis concept and principles
Se6162 analysis concept and principlesSe6162 analysis concept and principles
Se6162 analysis concept and principles
 
Performance Testing
Performance TestingPerformance Testing
Performance Testing
 
Vehicle management system
Vehicle management systemVehicle management system
Vehicle management system
 
Vehicle management system
Vehicle management systemVehicle management system
Vehicle management system
 
Service quality monitoring system architecture
Service quality monitoring system architectureService quality monitoring system architecture
Service quality monitoring system architecture
 
DITEC - Software Engineering
DITEC - Software EngineeringDITEC - Software Engineering
DITEC - Software Engineering
 
ADF Performance Monitor
ADF Performance MonitorADF Performance Monitor
ADF Performance Monitor
 

More from Betclic Everest Group Tech Team

Mini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedMini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedBetclic Everest Group Tech Team
 

More from Betclic Everest Group Tech Team (20)

Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)Mini training - Reactive Extensions (Rx)
Mini training - Reactive Extensions (Rx)
 
Mini training - Moving to xUnit.net
Mini training - Moving to xUnit.netMini training - Moving to xUnit.net
Mini training - Moving to xUnit.net
 
Mini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure StorageMini training - Introduction to Microsoft Azure Storage
Mini training - Introduction to Microsoft Azure Storage
 
Akka.Net
Akka.NetAkka.Net
Akka.Net
 
Mini training- Scenario Driven Design
Mini training- Scenario Driven DesignMini training- Scenario Driven Design
Mini training- Scenario Driven Design
 
Email Management in Outlook
Email Management in OutlookEmail Management in Outlook
Email Management in Outlook
 
Mini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity FoundationMini-Training: SSO with Windows Identity Foundation
Mini-Training: SSO with Windows Identity Foundation
 
Training - What is Performance ?
Training  - What is Performance ?Training  - What is Performance ?
Training - What is Performance ?
 
Mini-Training: Docker
Mini-Training: DockerMini-Training: Docker
Mini-Training: Docker
 
Mini Training Flyway
Mini Training FlywayMini Training Flyway
Mini Training Flyway
 
Mini-Training: NDepend
Mini-Training: NDependMini-Training: NDepend
Mini-Training: NDepend
 
Management 3.0 Workout
Management 3.0 WorkoutManagement 3.0 Workout
Management 3.0 Workout
 
Lean for Business
Lean for BusinessLean for Business
Lean for Business
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Training – Going Async
Training – Going AsyncTraining – Going Async
Training – Going Async
 
Mini-Training: Mobile UX Trends
Mini-Training: Mobile UX TrendsMini-Training: Mobile UX Trends
Mini-Training: Mobile UX Trends
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Mini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation DemystifiedMini-training: Personalization & Recommendation Demystified
Mini-training: Personalization & Recommendation Demystified
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
 

Recently uploaded

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Visual Studio Profiler

  • 1. Visual Studio Profiler let’s start a profiling session ! Maxime Lemaitre – 23/07/2013 Profiling Tools
  • 2. • Let developers measure, evaluate, and target performance-related issues in their code – CPU, Memory, Concurrency, ADO.NET… • Command-line tools but fully integrated into the IDE • Since VS 2012, available in Pro Version • Really powerful tools but poorly documented/blogged • Needs knowledge on the application and on .net framework Introduction on MSDN 2 Profiling Tools Introduction
  • 3. Here is the general process : • Configure the performance session by specifying the profiling method and the data that you want to collect. • Collect profiling data by running the application in the performance session. • Analyze the data to identify the performance issue. • Modify code with the goal to increases the application performance of the code • Collect profiling data on the changed code, and compare the profiling data of the original and changed data. • Generate a report that documents the increase in performance. 3 Profiling Workflow
  • 4. There are 4 profiling available methods • CPU Sampling – Collects application statistics that are useful for initial analysis and for analyzing CPU utilization issues. • Instrumentation – Collects detailed timing data that are useful for focused analysis and for analyzing input/output performance issues. • .NET Memory Allocation – Collects .NET Framework memory allocation data by using the sampling profiling method. • Concurrency – Collects numeric resource contention data. 4 Choosing a Profiling Method Can be attached to a running process !
  • 5. The sampling profiling method of the Profiling Tools interrupts the computer processor at set intervals and collects the function call stack. The profiler analysis determines whether the processor is executing code in the target process. If the processor is not executing code in the target process, the sample is discarded. • Inclusive samples – The total number of samples that are collected during the execution of the target function. – This includes samples that are collected during the direct execution of the function code and samples that are collected during the execution of child functions that are called by the target function. • Exclusive samples – The number of samples that are collected during the direct execution of the instructions of the target function. – Exclusive samples do not include samples that are collected during the execution of functions that are called by the target function. • Inclusive percent • Exclusive percent 5 Sampling Profiling Method Too Many Samples ? - Slow piece of code - Too many calls to a piece of code => For sure, there is something to optimize
  • 6. The instrumentation profiling method of the Profiling Tools records detailed timing information for the function calls, lines, and instructions in the profiled application The instrumentation method injects code at the start and end of target functions in the profiled binary, and before and after each call by those functions to other functions. The injected code records interval between collects and OS operations. • Elapsed Inclusive values – The total time that was spent executing a function and its child functions. • Elapsed Exclusive values – The time that was spent executing a function, excluding time that was spent in child functions. • Application Inclusive values – The time that was spent executing a function and its child functions, excluding time that was spent in operating system events. • Application Exclusive values – The time that was spent executing a function, excluding the time that was spent in child functions and the time that was spent in operating system events. • Elapsed Inclusive & Exclusive percent • Application Inclusive & Exclusive percent 6 Instrumentation Profiling Method
  • 7. The .NET memory allocation profiling method of Profiling Tools collects information about the size and number of objects that were created in an allocation or destroyed in a garbage collection and a few additional information. The memory profiler interrupts the computer processor at each allocation of a .NET Framework object in a profiled application. When object lifetime data is also collected, the profiler interrupts the processor after each .NET Framework garbage collection. The data is aggregated for each profiled function and for each type of object. • Allocation Data – Total counts and sizes of the allocated or destroyed memory objects • Lifetime Data – Displays the number and size of the objects and the generation when they are reclaimed 7 Memory Profiling Method
  • 8. Resource contention profiling collects detailed call stack information each time competing threads in an application are forced to wait for access to a shared resource. Resource contention reports display the total number of contentions and the total time that was spent waiting for a resource for the modules, functions, source code lines, and instructions in which the waiting occured. • Inclusive values – Contentions that were caused by child functions that were called by the function are included in inclusive values. • Exclusive values – Contentions caused by child functions are not included. The exclusive time for the function also includes only the wait times that were caused by statements in the function body. 8 Concurrency profiling method
  • 9. • Adds information to a profiling data file about synchronous ADO.NET calls between an application and a SQL Server database • Can be added to profiling data that is collected with the sampling, instrumentation, .NET memory, or concurrency methods 9 Tier Interaction Hidden profiling method For example, 1204 requests to the Casino Home Page
  • 10. 10 Profiling Quick Start this often begins with a wizard …
  • 12. • Enables us to configure and start performance sessions – Created/Filled by Performance Wizard 12 Performance Explorer Session Name The name of the session. Right-click the session name to edit the session properties Targets Binaries that are to be profiled in the session. Can be a binary, a VS project, or Web site. Each target have own Properties. Reports Files that are generated for the session. Right-click a report name to open, remove, or export a profiler data file. Can compare two profiler data files.
  • 13. 13 Profiling… Pause suspend data collection Stop profiling end the profiling session When profiling you have nothing to do : - Let is run for standalone app (Console, Test, ..) - Navigate between pages/forms (Web Site or Desktop)
  • 14. 1 - Hot Path branch of your application's call tree that was most active when data was collected 2 - Functions Doing the Most Individual Work. functions with the highest exclusive samples 3 - Summary Timeline timeline graph & CPU usage 4 - Error List uses a set of rules to suggest ways of improving the profiling run and to identify possible performance problems 14 Summary View Summary depends on Profiling method !
  • 15. There are also a few others Views of profiling data files are displayed • Call Tree • Modules View • Functions View • Object Lifetime View • Thread Details View • Tier Interaction Views • … 15 Analysis Results
  • 17. 17 Demo #1 ASP.NET MVC 4 Sample (Magazine website) Many Samples in Dal code and many calls to the db. Missing cache ?
  • 18. 18 Demo #2 Micro Benchmarking a Translation Helper (in Unit Test) More than 93% of elapsed time is spent on Regex.Replace … For sure, there is something to improve in the helper.
  • 19. 19 Demo #3 Task cancellation Helper For 100 000 tests, 300 000 tasks were allocated. Ouh ! For sure, memory consumption is not optimal when task is already completed.
  • 20. • Profiling data can be collected through the ASP.NET profiler when we run a web or a load test – Limited to sampling and tier interaction data – Not appropriate for long runs (profiler file can become large …) • Really powerful if you have real scenarios & test cases 20 Profiling ASP.NET Web & Load Tests You just have to select ASP.NET profiler for your test settings
  • 21. • Instrumentation profiling can provide a greater level of detail ; this means that more data is collected and instrumentation is more likely to impact the performance • The Visual Studio profiler provides an API for controlling data collection from within an application – allow us to limit the amount of data that is collected during a profiling session. Simply add a reference to ToolsMicrosoft.VisualStudio.Profiler.dll (VSDirToolsPerformance Tools) 21 Profiler APIs
  • 22. Right-click a test and choose Profile Test to run performance analysis on a single unit test 22 Profiling Unit Tests Since VS 2012 update 2 The test runs as usual followed by the analysis (sampling method). When analysis completes, you’ll see the classic summary view
  • 24. • http://msdn.microsoft.com/en-us/library/ms182372.aspx • http://msdn.microsoft.com/en-us/library/z9z62c29.aspx • http://blogs.msdn.com/b/dotnet/archive/2013/04/04/net-memory-allocation- profiling-with-visual-studio-2012.aspx • http://blogs.msdn.com/b/anilchandra/archive/2012/09/24/test.aspx • http://blogs.msdn.com/b/visualstudioalm/archive/tags/diagnostics/ • http://blogs.msdn.com/b/dotnet/archive/2013/04/04/net-memory-allocation- profiling-with-visual-studio-2012.aspx 24 Appendices & References
  • 25. Find out more • On https://techblog.betclicgroup.com/
  • 26. About Betclic • Betclic Everest Group, one of the world leaders in online gaming, has a unique portfolio comprising various complementary international brands: Betclic, Everest Gaming, bet-at-home.com, Expekt… • Active in 100 countries with more than 12 million customers worldwide, the Group is committed to promoting secure and responsible gaming and is a member of several international professional associations including the EGBA (European Gaming and Betting Association) and the ESSA (European Sports Security Association). • Through our brands, Betclic Everest Group places expertise, technological know-how and security at the heart of our strategy to deliver an on-line gaming offer attuned to the passion of our players.