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

Ten Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLTen Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLanandology
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMarco Tusa
 
The Mechanics of Testing Large Data Pipelines (QCon London 2016)
The Mechanics of Testing Large Data Pipelines (QCon London 2016)The Mechanics of Testing Large Data Pipelines (QCon London 2016)
The Mechanics of Testing Large Data Pipelines (QCon London 2016)Mathieu Bastian
 
Mysql data replication
Mysql data replicationMysql data replication
Mysql data replicationTuấn Ngô
 
Tutorial moodle (Bahasa indonesia)
Tutorial moodle (Bahasa indonesia)Tutorial moodle (Bahasa indonesia)
Tutorial moodle (Bahasa indonesia)Gie Yori
 
Dash plotly data visualization
Dash plotly data visualizationDash plotly data visualization
Dash plotly data visualizationCharu Gupta
 
Fundamentals of Database Management Systems 2nd Edition Gillenson Test Bank
Fundamentals of Database Management Systems 2nd Edition Gillenson Test BankFundamentals of Database Management Systems 2nd Edition Gillenson Test Bank
Fundamentals of Database Management Systems 2nd Edition Gillenson Test Bankxyfeq
 
Webinar: MongoDB Schema Design and Performance Implications
Webinar: MongoDB Schema Design and Performance ImplicationsWebinar: MongoDB Schema Design and Performance Implications
Webinar: MongoDB Schema Design and Performance ImplicationsMongoDB
 
White paper on Spool space in teradata
White paper on Spool space in teradataWhite paper on Spool space in teradata
White paper on Spool space in teradataSanjeev Kumar Jaiswal
 
Introduction to SQL Antipatterns
Introduction to SQL AntipatternsIntroduction to SQL Antipatterns
Introduction to SQL AntipatternsKrishnakumar S
 
ClickHouse Deep Dive, by Aleksei Milovidov
ClickHouse Deep Dive, by Aleksei MilovidovClickHouse Deep Dive, by Aleksei Milovidov
ClickHouse Deep Dive, by Aleksei MilovidovAltinity Ltd
 
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!Frederic Descamps
 
Oracle database 12c sql worshop 2 student guide vol 1
Oracle database 12c sql worshop 2 student guide vol 1Oracle database 12c sql worshop 2 student guide vol 1
Oracle database 12c sql worshop 2 student guide vol 1Otto Paiz
 
PostgreSQL, performance for queries with grouping
PostgreSQL, performance for queries with groupingPostgreSQL, performance for queries with grouping
PostgreSQL, performance for queries with groupingAlexey Bashtanov
 
Optimizing queries MySQL
Optimizing queries MySQLOptimizing queries MySQL
Optimizing queries MySQLGeorgi Sotirov
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceMark Ginnebaugh
 
SQL Interview Questions - InterviewBit.pdf
SQL Interview Questions - InterviewBit.pdfSQL Interview Questions - InterviewBit.pdf
SQL Interview Questions - InterviewBit.pdfAniket223719
 
How To Visualize Graphs
How To Visualize GraphsHow To Visualize Graphs
How To Visualize GraphsJean Ihm
 
RANCANG BANGUN SISTEM INFORMASI PADA MUSEUM BALI BERBASIS WEB
RANCANG BANGUN SISTEM INFORMASI PADA MUSEUM BALI BERBASIS WEBRANCANG BANGUN SISTEM INFORMASI PADA MUSEUM BALI BERBASIS WEB
RANCANG BANGUN SISTEM INFORMASI PADA MUSEUM BALI BERBASIS WEBGoogle+
 

What's hot (20)

Ten Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLTen Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pages
 
The Mechanics of Testing Large Data Pipelines (QCon London 2016)
The Mechanics of Testing Large Data Pipelines (QCon London 2016)The Mechanics of Testing Large Data Pipelines (QCon London 2016)
The Mechanics of Testing Large Data Pipelines (QCon London 2016)
 
Mysql data replication
Mysql data replicationMysql data replication
Mysql data replication
 
Tutorial moodle (Bahasa indonesia)
Tutorial moodle (Bahasa indonesia)Tutorial moodle (Bahasa indonesia)
Tutorial moodle (Bahasa indonesia)
 
Dash plotly data visualization
Dash plotly data visualizationDash plotly data visualization
Dash plotly data visualization
 
Fundamentals of Database Management Systems 2nd Edition Gillenson Test Bank
Fundamentals of Database Management Systems 2nd Edition Gillenson Test BankFundamentals of Database Management Systems 2nd Edition Gillenson Test Bank
Fundamentals of Database Management Systems 2nd Edition Gillenson Test Bank
 
Webinar: MongoDB Schema Design and Performance Implications
Webinar: MongoDB Schema Design and Performance ImplicationsWebinar: MongoDB Schema Design and Performance Implications
Webinar: MongoDB Schema Design and Performance Implications
 
White paper on Spool space in teradata
White paper on Spool space in teradataWhite paper on Spool space in teradata
White paper on Spool space in teradata
 
Introduction to SQL Antipatterns
Introduction to SQL AntipatternsIntroduction to SQL Antipatterns
Introduction to SQL Antipatterns
 
ClickHouse Deep Dive, by Aleksei Milovidov
ClickHouse Deep Dive, by Aleksei MilovidovClickHouse Deep Dive, by Aleksei Milovidov
ClickHouse Deep Dive, by Aleksei Milovidov
 
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
 
Java Profiling Future
Java Profiling FutureJava Profiling Future
Java Profiling Future
 
Oracle database 12c sql worshop 2 student guide vol 1
Oracle database 12c sql worshop 2 student guide vol 1Oracle database 12c sql worshop 2 student guide vol 1
Oracle database 12c sql worshop 2 student guide vol 1
 
PostgreSQL, performance for queries with grouping
PostgreSQL, performance for queries with groupingPostgreSQL, performance for queries with grouping
PostgreSQL, performance for queries with grouping
 
Optimizing queries MySQL
Optimizing queries MySQLOptimizing queries MySQL
Optimizing queries MySQL
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database Performance
 
SQL Interview Questions - InterviewBit.pdf
SQL Interview Questions - InterviewBit.pdfSQL Interview Questions - InterviewBit.pdf
SQL Interview Questions - InterviewBit.pdf
 
How To Visualize Graphs
How To Visualize GraphsHow To Visualize Graphs
How To Visualize Graphs
 
RANCANG BANGUN SISTEM INFORMASI PADA MUSEUM BALI BERBASIS WEB
RANCANG BANGUN SISTEM INFORMASI PADA MUSEUM BALI BERBASIS WEBRANCANG BANGUN SISTEM INFORMASI PADA MUSEUM BALI BERBASIS WEB
RANCANG BANGUN SISTEM INFORMASI PADA MUSEUM BALI BERBASIS WEB
 

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

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
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
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
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
 

Recently uploaded (20)

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
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
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
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
 

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.