Questions tagged [profiling]

Profiling is the process of measuring an application or system by running an analysis tool called a profiler. Profiling tools can focus on many aspects: functions call times and count, memory usage, cpu load, and resource usage.

Profiling is the process of measuring an application or system by running an analysis tool called a profiler. Profiling tools can focus on many aspects: functions call times and count, memory usage, cpu load, and resource usage.

5996 questions
2129
votes
19 answers

How do I profile C++ code running on Linux?

How do I find areas of my code that run slowly in a C++ application running on Linux?
Gabriel Isenberg
  • 25,869
  • 4
  • 37
  • 58
1710
votes
30 answers

How to measure time taken by a function to execute

I need to get execution time in milliseconds. I originally asked this question back in 2008. The accepted answer then was to use new Date().getTime() However, we can all agree now that using the standard performance.now() API is more appropriate.…
Julius A
  • 38,062
  • 26
  • 74
  • 96
1675
votes
34 answers

How do I profile a Python script?

Project Euler and other coding contests often have a maximum time to run or people boast of how fast their particular solution runs. With Python, sometimes the approaches are somewhat kludgey - i.e., adding timing code to __main__. What is a good…
Chris Lawlor
  • 47,306
  • 11
  • 48
  • 68
923
votes
3 answers

Why does Python code run faster in a function?

def main(): for i in xrange(10**8): pass main() This piece of code in Python runs in (Note: The timing is done with the time function in BASH in Linux.) real 0m1.841s user 0m1.828s sys 0m0.012s However, if the for loop isn't…
thedoctar
  • 8,943
  • 3
  • 20
  • 31
759
votes
8 answers

Which Python memory profiler is recommended?

I want to know the memory usage of my Python application and specifically want to know what code blocks/portions or objects are consuming most memory. Google search shows a commercial one is Python Memory Validator (Windows only). And open source…
Anurag Uniyal
  • 85,954
  • 40
  • 175
  • 219
451
votes
13 answers

How do I measure the execution time of JavaScript code with callbacks?

I have a piece of JavaScript code that I am executing using the node.js interpreter. for(var i = 1; i < LIMIT; i++) { var user = { id: i, name: "MongoUser [" + i + "]" }; db.users.save(user, function(err, saved) { if(err || !saved)…
Stormshadow
  • 6,769
  • 9
  • 33
  • 34
373
votes
30 answers

What Are Some Good .NET Profilers?

What profilers have you used when working with .net programs, and which would you particularly recommend?
ricree
  • 35,626
  • 13
  • 36
  • 27
351
votes
9 answers

How do I profile memory usage in Python?

I've recently become interested in algorithms and have begun exploring them by writing a naive implementation and then optimizing it in various ways. I'm already familiar with the standard Python module for profiling runtime (for most things I've…
Redwood
  • 66,744
  • 41
  • 126
  • 187
349
votes
15 answers

Measuring function execution time in R

Is there a standardized way in R of measuring execution time of function? Obviously I can take system.time before and after execution and then take the difference of those, but I would like to know if there is some standardized way or function…
dns
  • 3,491
  • 2
  • 15
  • 3
320
votes
14 answers

Simplest way to profile a PHP script

What's the easiest way to profile a PHP script? I'd love tacking something on that shows me a dump of all function calls and how long they took but I'm also OK with putting something around specific functions. I tried experimenting with the…
Mark Biek
  • 146,731
  • 54
  • 156
  • 201
267
votes
7 answers

How do I analyze a .hprof file?

I have a production server running with the following flag: -XX:+HeapDumpOnOutOfMemoryError Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but…
Nick Stinemates
  • 41,511
  • 21
  • 59
  • 60
252
votes
6 answers

How to get object size in memory?

I need to know how much bytes my object consumes in memory (in C#). for example how much my Hashtable, or SortedList, or List.
Lukas Šalkauskas
  • 14,191
  • 20
  • 61
  • 77
248
votes
2 answers

Difference between 'self' and 'total' in Chrome CPU Profile of JS

What is the difference between the 'self' and 'total' columns in the Chrome CPU profiling of JS code?
CoolUserName
  • 3,715
  • 6
  • 26
  • 30
239
votes
13 answers

What's the best free C++ profiler for Windows?

I'm looking for a profiler in order to find the bottleneck in my C++ code. I'd like to find a free, non-intrusive, and good profiling tool. I'm a game developer, and I use PIX for Xbox 360 and found it very good, but it's not free. I know the Intel…
ugasoft
  • 3,778
  • 7
  • 27
  • 23
231
votes
14 answers

Measuring execution time of a function in C++

I want to find out how much time a certain function takes in my C++ program to execute on Linux. Afterwards, I want to make a speed comparison . I saw several time function but ended up with this from boost. Chrono: process_user_cpu_clock, captures…
Xara
  • 8,748
  • 16
  • 52
  • 82
1
2 3
99 100