Performance/Memory profiling for a C#/XAML App [duplicate] - c#

This question already has answers here:
What Are Some Good .NET Profilers?
(30 answers)
Closed 9 years ago.
I am currently working on a C#/XAML application, I need to do performance profiling to figure out XAML bottlenecks. Any good profilers/tools available?

Visual Studio (Performance tools) download and How to do.
RedGate Ants Profiler
Telerik JustTrace
The last 2 are good ones, and not free

PerfView is free tool that is used by the CLR performance team. It is specifically designed for profiling the performance of .NET applications and can do both CPU and memory (managed heap) investigations. A plus is that it doesn't require running an install on a machine to collect performance data. There is an awesome series of videos by Vance Morrison on using the tool.

what app are you developing, WPF, Silverlight or win8? Basiclly the profile tool inside Visual Studio is enough to figure out the bottlenecks.

Related

how using GPU from c# code to compress bitmap [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I am trying to get more processing power out of my grid.
I am using all cpus/cores, is it possible to utilize the GPU with C#.
Anyone know any libraries or got any sample code?
[Edit OCT 2017 as even this answer gets quite old]
Most of these answers are quite old, so I thought I'd give an updated summary of where I think each project is:
GPU.Net (TidePowerd) - I tried this 6 months ago or so, and did get it working though it took a little bit of work. Converts C# kernel code to cuda at compile time. Unfortunately their website has been down and their github hasn't been updated for a couple of years, which might indicate the project is dead....
Cudafy - Open source and very easy to use. Converts C# kernel code to cuda at runtime (with ability to serialize and cache). Can easily run the same kernel code on the CPU (mostly for debugging). Supports multiple GPUs. More examples available than others here. The boilerplate code referred to by other answers is minimal, and in my case at least helped with my understanding of how the code works. Cuda/Nvidia only though. Unfortunately, it seems that they didn't update their solutions for a couple of years too (latest commit in 2015 -- support of cuda 7.0).
Hybridizer. Commercial solution compiling C# to CUDA. Provides a free community edition on visual studio marketplace and samples on github.
AleaGPU Commercial solution with a free community edition for consumer GPUS. See Daniel's comments for details.
Brahma - runs LINQ expressions via OpenCL (so supports AMD too). Not much documentation / examples. Last update in 2011.
C$ - last development was over 10 years ago...
Microsoft Accelerator - similarly doesn't look like it is being actively developed any longer.
some others (C++ AMP, OpenTK -- dead/Cloo) - many of these are just bindings - ie enable you to call the GPU from C#, but your kernel code (code which is actually run on the GPU) needs to be written in C or OpenCL, meaning you must use (and learn) another language.
As I said, I would recommend Cudafy over all the others - if it could run on OpenCL as well as Cuda it would be perfect.
EDIT SEP 2013
Cudafy now allows you to compile for both CUDA and OpenCL, so will run the same C# code on on all GPUs. This sounds fantastic, though I haven't tested the OpenCL compiling yet.
Microsoft Research Accelerator was a .NET GP GPU library.
I found Brahma... It also has a GPGPU provider that allows methods to run on the GPU... Thanks for the question... Learnt something new today. :)
Here's another one: CUDAfy. It sounds like GPU.Net, in that something as simple as a method-attribute can cause the entire method to run on the GPU. But unlike GPU.Net, CUDAfy is free and open-source.
GPU.Net appears to require no boilerplate code, though (According to their docs, it's "injected automatically by the build-tool"), while CUDAfy does.
Here is an example of building an application with CUDAfy.
Could I recommend XNA Game Studio as a possible avenue for exploration? It is obviously geared up for writing games, but gives you managed access to your graphics card and much better access to capability enumeration functions and shader development than was previously available in, say, Managed DirectX. There are also ways of combining WinForms and XNA into hybrid applications:
http://www.ziggyware.com/news.php?readmore=866
You'll have to put some effort into learning shader programming (XNA supports HLSL), but this may be a simpler approach than learning a vendor-specific solution such as nVidia's CUDA. The advantage is that you can program in a 100% managed environment. Here are some HLSL links:
http://www.ziggyware.com/weblinks.php?cat_id=9
The GPGPU site is also a recommended destination for general purpose GPU programming:
http://gpgpu.org/
Best of luck!
How about http://www.tidepowerd.com/ GPU.NET ?
Well this is a pretty old question, and since it's been asked things have changed a lot.
Another option for using .Net to write GPU code, which no one has mentioned in answers in Alea GPU. It covers C#, F# and VB.
Professional GPU software development environment for .NET and Mono.
Truly cross-platform
In F# official site, Alea is the first option for using F# in GPGPU programming.
To get to know this framework I suggest take a look at its comprehensive list of examples.
In addition to Brahma, take a look at C$ (pronounced "C Bucks"). From their CodePlex site:
The aim of [C$] is creating a unified language and system for seamless parallel programming on modern GPU's and CPU's.
It's based on C#, evaluated lazily, and targets multiple accelerator models:
Currently the list of
intended architectures includes GPU,
Multi-core CPU, Multi-GPU (SLI,
CrossFire), and Multi-GPU + Multi-CPU
Hybrid Architecture.
There's a new Microsoft solution in town - C++ AMP (intro here).
Use from C# would be via P/Invoke, as demoed here for desktop apps, and here for (don't-call-it) Metro apps.
Edit: I should note that C++ AMP has an open specification, which means it's not necessarily just for the MS compiler, or just for Windows.
Edit: Apparently, the technology is now in "maintenance mode," meaning they're fixing bugs, but not actively developing.
If your GPUs are all the same brand, you might be able to get GPGPU support from the vendor, either through Nvidia's CUDA or ATI's Stream. AFAIK, they provide DLLs, which you could use through P/Invoke.
CenterSpace Software has GPU-powered computation in their NMath libraries you can add to C# project. It's a commercial product.
Managed DirectX somehow, might work
WPF also uses the GPU and you can add custom shaders using HLSL.
A Series on GPU-based Effects for WPF (Greg Schechter's Blog)

Can C# be used in embedded environments? [duplicate]

This question already has answers here:
C# for embedded systems? [closed]
(11 answers)
Closed 8 years ago.
As I'm learning C# and my budding interest in embedded devices, I wondered If I can use C# in an embedded environment. How is C# going to help us in the realm of the Internet Of Things.
Note: The only question I found that resemble this is this one: C# for embedded devices
But this question has been asked 3 years ago. Obviously many things have changed since then.
Yes, there are at least three ways:
Through the .Net Micro Framework, however .Net MF is supported on a limited range of architectures, has a footprint of around 300Kb, and is not a hard real-time OS - thus precluding it form a large section of embedded applications. Although originally a Microsoft product, it is now an open source project.
The .NET Compact Framework running on Windows Embedded CE or Windows Mobile.
Through Mono running on embedded Linux.
C# requires a runtime environment that is not insubstantial which is its biggest barrier to embedded deployment in many applications. However if you have a platform with resources in the order of 4Mb ROM, and 1Mb RAM, or sufficient to support CE or Linux, then it is entirely possible. For high volumes or high value products, with complex UI and connectivity requirements it may make sense, but for simple applications it may be hardly worth the resource overhead and hardware cost.

There is a way to know how long each function running in C # in Visual Studio? [duplicate]

This question already has answers here:
Best .NET memory and performance profiler? [closed]
(11 answers)
Closed 8 years ago.
I am looking for information about runtime of function,
like "Include actual execution plan" in SqlServer,
to know how much time took every function execution,
there is any way?
I am work in ASP.NET c# application vs 2003.
Thanks.
You can use profiler such as
ants-performance-profiler
dotTrace
See this question: Best .NET memory and performance profiler?
You can always use the c# Stopwatch to track how long things are taking:
http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch(v=vs.110).aspx
If this is production code and you are worried about the performance, it would probably be worth while to add it's performance to your logging/diagnostics structure, so that it can be monitored in the field.
Check with speed trace and appsight. They are pretty detailed in profiling and recording data.

Performance measurement of .NET application [duplicate]

This question already has answers here:
What Are Some Good .NET Profilers?
(30 answers)
Closed 9 years ago.
I have converted 32-bit application to 64-bit. How do I measure performance of application in both versions.
Is there any benchmarking/ performance measurement tool/dll?
Is it possible to measure performance on module/functionality level rather than entire application. For example, I would like to see performance GraphicsRender functionality in 32-bit and 64-bit machines.
Thanks in advance.
The one is available by microsoft for .net profiling is CLR Profiler for .NET Framework 4. You can use that for any of your .Net 4.0 application. For 2.0 the same profiler is also available.
You can give it try to jetbrains profiler for performance measurements.
Try to use ANTS Profiler: http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/
It is as a free trial period. You can install it in your Visual Studio.
Is measures how many time a method is called, it's execution time and also measures memory consumption.

Utilizing the GPU with c# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I am trying to get more processing power out of my grid.
I am using all cpus/cores, is it possible to utilize the GPU with C#.
Anyone know any libraries or got any sample code?
[Edit OCT 2017 as even this answer gets quite old]
Most of these answers are quite old, so I thought I'd give an updated summary of where I think each project is:
GPU.Net (TidePowerd) - I tried this 6 months ago or so, and did get it working though it took a little bit of work. Converts C# kernel code to cuda at compile time. Unfortunately their website has been down and their github hasn't been updated for a couple of years, which might indicate the project is dead....
Cudafy - Open source and very easy to use. Converts C# kernel code to cuda at runtime (with ability to serialize and cache). Can easily run the same kernel code on the CPU (mostly for debugging). Supports multiple GPUs. More examples available than others here. The boilerplate code referred to by other answers is minimal, and in my case at least helped with my understanding of how the code works. Cuda/Nvidia only though. Unfortunately, it seems that they didn't update their solutions for a couple of years too (latest commit in 2015 -- support of cuda 7.0).
Hybridizer. Commercial solution compiling C# to CUDA. Provides a free community edition on visual studio marketplace and samples on github.
AleaGPU Commercial solution with a free community edition for consumer GPUS. See Daniel's comments for details.
Brahma - runs LINQ expressions via OpenCL (so supports AMD too). Not much documentation / examples. Last update in 2011.
C$ - last development was over 10 years ago...
Microsoft Accelerator - similarly doesn't look like it is being actively developed any longer.
some others (C++ AMP, OpenTK -- dead/Cloo) - many of these are just bindings - ie enable you to call the GPU from C#, but your kernel code (code which is actually run on the GPU) needs to be written in C or OpenCL, meaning you must use (and learn) another language.
As I said, I would recommend Cudafy over all the others - if it could run on OpenCL as well as Cuda it would be perfect.
EDIT SEP 2013
Cudafy now allows you to compile for both CUDA and OpenCL, so will run the same C# code on on all GPUs. This sounds fantastic, though I haven't tested the OpenCL compiling yet.
Microsoft Research Accelerator was a .NET GP GPU library.
I found Brahma... It also has a GPGPU provider that allows methods to run on the GPU... Thanks for the question... Learnt something new today. :)
Here's another one: CUDAfy. It sounds like GPU.Net, in that something as simple as a method-attribute can cause the entire method to run on the GPU. But unlike GPU.Net, CUDAfy is free and open-source.
GPU.Net appears to require no boilerplate code, though (According to their docs, it's "injected automatically by the build-tool"), while CUDAfy does.
Here is an example of building an application with CUDAfy.
Could I recommend XNA Game Studio as a possible avenue for exploration? It is obviously geared up for writing games, but gives you managed access to your graphics card and much better access to capability enumeration functions and shader development than was previously available in, say, Managed DirectX. There are also ways of combining WinForms and XNA into hybrid applications:
http://www.ziggyware.com/news.php?readmore=866
You'll have to put some effort into learning shader programming (XNA supports HLSL), but this may be a simpler approach than learning a vendor-specific solution such as nVidia's CUDA. The advantage is that you can program in a 100% managed environment. Here are some HLSL links:
http://www.ziggyware.com/weblinks.php?cat_id=9
The GPGPU site is also a recommended destination for general purpose GPU programming:
http://gpgpu.org/
Best of luck!
How about http://www.tidepowerd.com/ GPU.NET ?
Well this is a pretty old question, and since it's been asked things have changed a lot.
Another option for using .Net to write GPU code, which no one has mentioned in answers in Alea GPU. It covers C#, F# and VB.
Professional GPU software development environment for .NET and Mono.
Truly cross-platform
In F# official site, Alea is the first option for using F# in GPGPU programming.
To get to know this framework I suggest take a look at its comprehensive list of examples.
In addition to Brahma, take a look at C$ (pronounced "C Bucks"). From their CodePlex site:
The aim of [C$] is creating a unified language and system for seamless parallel programming on modern GPU's and CPU's.
It's based on C#, evaluated lazily, and targets multiple accelerator models:
Currently the list of
intended architectures includes GPU,
Multi-core CPU, Multi-GPU (SLI,
CrossFire), and Multi-GPU + Multi-CPU
Hybrid Architecture.
There's a new Microsoft solution in town - C++ AMP (intro here).
Use from C# would be via P/Invoke, as demoed here for desktop apps, and here for (don't-call-it) Metro apps.
Edit: I should note that C++ AMP has an open specification, which means it's not necessarily just for the MS compiler, or just for Windows.
Edit: Apparently, the technology is now in "maintenance mode," meaning they're fixing bugs, but not actively developing.
If your GPUs are all the same brand, you might be able to get GPGPU support from the vendor, either through Nvidia's CUDA or ATI's Stream. AFAIK, they provide DLLs, which you could use through P/Invoke.
CenterSpace Software has GPU-powered computation in their NMath libraries you can add to C# project. It's a commercial product.
Managed DirectX somehow, might work
WPF also uses the GPU and you can add custom shaders using HLSL.
A Series on GPU-based Effects for WPF (Greg Schechter's Blog)

Categories