Why doesn’t perf report cache misses?

On my system, an Intel Xeon X5570 @ 2.93 GHz I was able to get perf stat to report cache references and misses by requesting those events explicitly like this perf stat -B -e cache-references,cache-misses,cycles,instructions,branches,faults,migrations sleep 5 Performance counter stats for ‘sleep 5’: 10573 cache-references 1949 cache-misses # 18.434 % of all cache refs 1077328 … Read more

Searching for a string in a large text file – profiling various methods in python

Variant 1 is great if you need to launch many sequential searches. Since set is internally a hash table, it’s rather good at search. It takes time to build, though, and only works well if your data fit into RAM. Variant 3 is good for very big files, because you have plenty of address space … Read more

How do I use line_profiler (from Robert Kern)?

This answer is a copy of my answer here for how to get line_profiler statistics from within a Python script (without using kernprof from the command line or having to add @profile decorators to functions and class methods). All answers (that I’ve seen) to similar line_profiler questions only describe using kernprof. The line_profiler test cases … Read more

How Can I Log and Find the Most Expensive Queries?

Use SQL Server Profiler (on the tools menu in SSMS) to create a trace that logs these events: RPC:Completed SP:Completed SP:StmtCompleted SQL:BatchCompleted SQL:StmtCompleted You can start with the standard trace template and prune it. You didn’t specify whether this was for a specific database or the whole server, if it is for specific Db’s, include … Read more

Can I profile my .zshrc/.zshenv?

Try adding this at the beginning of the file: # set the trace prompt to include seconds, nanoseconds, script name and line number # This is GNU date syntax; by default Macs ship with the BSD date program, which isn’t compatible PS4=’+$(date “+%s:%N”) %N:%i> ‘ # save file stderr to file descriptor 3 and redirect … Read more

Where is the Query Analyzer in SQL Server Management Studio 2008 R2?

To analyze a query you already have entered into the Query editor, you need to choose “Include Actual Execution Plan” (7th toggle button to the right of the “! Execute” button). After executing the query, you need to click on the “Execution Plan” tab in the results pane at the bottom (above the results of … Read more

How do I profile my Perl programs?

(This is the official perlfaq answer, minus any subsequent edits) The Devel namespace has several modules which you can use to profile your Perl programs. The Devel::DProf module comes with Perl and you can invoke it with the -d switch: $ perl -d:DProf program.pl After running your program under DProf, you’ll get a tmon.out file … Read more

How to memory profile in Java?

Strings are problematic Basically in Java, String references ( things that use char[] behind the scenes ) will dominate most business applications memory wise. How they are created determines how much memory they consume in the JVM. Just because they are so fundamental to most business applications as a data type, and they are one … Read more

What tools do you recommend to profile Rails apps? [closed]

You can use the built in profiler as well: $ ruby script/performance/profiler ‘User.new’ 5 % cumulative self self total time seconds seconds calls ms/call ms/call name 189.25 1.76 1.76 1 1760.00 1760.00 Profiler__.start_profile 43.01 2.16 0.40 115 3.48 3.91 ActiveRecord::ConnectionAdapters::Column#simplified_type 8.60 2.24 0.08 15 5.33 8.67 Array#each 7.53 2.31 0.07 115 0.61 5.39 ActiveRecord::ConnectionAdapters::Column#initialize 6.45 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)