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

Tech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboardsTech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboardsAppsilon Data Science
 
Graph representation learning to prevent payment collusion fraud
Graph representation learning to prevent payment collusion fraudGraph representation learning to prevent payment collusion fraud
Graph representation learning to prevent payment collusion fraudDataWorks Summit
 
Spark DataFrames and ML Pipelines
Spark DataFrames and ML PipelinesSpark DataFrames and ML Pipelines
Spark DataFrames and ML PipelinesDatabricks
 
Building a distributed search system with Hadoop and Lucene
Building a distributed search system with Hadoop and LuceneBuilding a distributed search system with Hadoop and Lucene
Building a distributed search system with Hadoop and LuceneMirko Calvaresi
 
Machine learning at scale with Google Cloud Platform
Machine learning at scale with Google Cloud PlatformMachine learning at scale with Google Cloud Platform
Machine learning at scale with Google Cloud PlatformMatthias Feys
 
Use Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorUse Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorMaxim Shelest
 
Spark shuffle introduction
Spark shuffle introductionSpark shuffle introduction
Spark shuffle introductioncolorant
 
Introduction to Apache solr
Introduction to Apache solrIntroduction to Apache solr
Introduction to Apache solrKnoldus Inc.
 
Introduction to Spark with Python
Introduction to Spark with PythonIntroduction to Spark with Python
Introduction to Spark with PythonGokhan Atil
 
[FFE19] Build a Flink AI Ecosystem
[FFE19] Build a Flink AI Ecosystem[FFE19] Build a Flink AI Ecosystem
[FFE19] Build a Flink AI EcosystemJiangjie Qin
 
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInDataModel serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInDataGetInData
 
Introduction to Python Programming language.pptx
Introduction to Python Programming language.pptxIntroduction to Python Programming language.pptx
Introduction to Python Programming language.pptxBharathYusha1
 
Neo4j Webinar: Graphs in banking
Neo4j Webinar:  Graphs in banking Neo4j Webinar:  Graphs in banking
Neo4j Webinar: Graphs in banking Neo4j
 
An introduction to Jupyter notebooks and the Noteable service
An introduction to Jupyter notebooks and the Noteable serviceAn introduction to Jupyter notebooks and the Noteable service
An introduction to Jupyter notebooks and the Noteable serviceJisc
 
Presentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptxPresentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptxNitinKhandelwal71
 
MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle Databricks
 

What's hot (20)

InfluxDB & Grafana
InfluxDB & GrafanaInfluxDB & Grafana
InfluxDB & Grafana
 
Tech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboardsTech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboards
 
Graph representation learning to prevent payment collusion fraud
Graph representation learning to prevent payment collusion fraudGraph representation learning to prevent payment collusion fraud
Graph representation learning to prevent payment collusion fraud
 
Spark DataFrames and ML Pipelines
Spark DataFrames and ML PipelinesSpark DataFrames and ML Pipelines
Spark DataFrames and ML Pipelines
 
Building a distributed search system with Hadoop and Lucene
Building a distributed search system with Hadoop and LuceneBuilding a distributed search system with Hadoop and Lucene
Building a distributed search system with Hadoop and Lucene
 
Machine learning at scale with Google Cloud Platform
Machine learning at scale with Google Cloud PlatformMachine learning at scale with Google Cloud Platform
Machine learning at scale with Google Cloud Platform
 
Use Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorUse Cases for Elastic Search Percolator
Use Cases for Elastic Search Percolator
 
Unit 3
Unit 3Unit 3
Unit 3
 
Spark shuffle introduction
Spark shuffle introductionSpark shuffle introduction
Spark shuffle introduction
 
Introduction to Apache solr
Introduction to Apache solrIntroduction to Apache solr
Introduction to Apache solr
 
Introduction to Spark with Python
Introduction to Spark with PythonIntroduction to Spark with Python
Introduction to Spark with Python
 
Map Reduce
Map ReduceMap Reduce
Map Reduce
 
[FFE19] Build a Flink AI Ecosystem
[FFE19] Build a Flink AI Ecosystem[FFE19] Build a Flink AI Ecosystem
[FFE19] Build a Flink AI Ecosystem
 
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInDataModel serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
Model serving made easy using Kedro pipelines - Mariusz Strzelecki, GetInData
 
Introducing Splunk – The Big Data Engine
Introducing Splunk – The Big Data EngineIntroducing Splunk – The Big Data Engine
Introducing Splunk – The Big Data Engine
 
Introduction to Python Programming language.pptx
Introduction to Python Programming language.pptxIntroduction to Python Programming language.pptx
Introduction to Python Programming language.pptx
 
Neo4j Webinar: Graphs in banking
Neo4j Webinar:  Graphs in banking Neo4j Webinar:  Graphs in banking
Neo4j Webinar: Graphs in banking
 
An introduction to Jupyter notebooks and the Noteable service
An introduction to Jupyter notebooks and the Noteable serviceAn introduction to Jupyter notebooks and the Noteable service
An introduction to Jupyter notebooks and the Noteable service
 
Presentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptxPresentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptx
 
MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle MLFlow: Platform for Complete Machine Learning Lifecycle
MLFlow: Platform for Complete Machine Learning Lifecycle
 

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 systemWeTheCoders
 
Vehicle management system
Vehicle management systemVehicle management system
Vehicle management systemwethecodershelp
 
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

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

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.