Skip to content

Commit

Permalink
mtlpypracticetalk
Browse files Browse the repository at this point in the history
  • Loading branch information
jvns committed Apr 6, 2015
1 parent 0a29d39 commit 3752440
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 21 deletions.
Binary file added 2015-03-mtlpypracticetalk/pageHeader2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2015-03-mtlpypracticetalk/python-logo-light.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 67 additions & 13 deletions 2015-03-mtlpypracticetalk/slides.md
@@ -1,17 +1,19 @@
# Spying on your programs with strace
# spying on your programs

by Julia Evans <br>
[`twitter.com/b0rk`][twitter] <br>
[`github.com/jvns`][github] <br>
[`jvns.ca`][website] <br>

* twitter: @b0rk <br>
* blog: jvns.ca

[github]: https://github.com/jvns
[twitter]: https://twitter.com/b0rk
[website]: http://jvns.ca

#

<img src="python-logo.png">
<img src="python-logo-light.png">

# your program <br> = <br> black box

# Debugging:

Expand Down Expand Up @@ -87,9 +89,9 @@ access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)

# open

```
<pre class="big">
strace -etrace=open google-chrome
```
</pre>
<img src="consent-to-send-stats.png">

# open
Expand Down Expand Up @@ -148,14 +150,66 @@ NULL, NULL) = 512

+ spy on log files!

# Thanks!
# Chapter 2: <br> The Case of the <br> Slow Program

# 3 Slow programs

1. CPU time
1. too many writes
1. waiting for a slow server

# Mystery program #1


#

<pre class="big">
$ time python mystery_1.py
0.09user 0.01system 0:02.11elapsed 5%CPU
</pre>

# wchan: wait channel

# demo demo

# sk_wait_data

Wait for some data on a network socket.

# We win! It was the network

* strace all the things!
* on OS X / Windows, try **sysdig**
* Notes: [http://bit.ly/strace-notes](http://bit.ly/strace-notes)
# Mystery program #2

```
$ time python mystery_2.py
2.74user 0.00system 0:02.74elapsed 99%CPU
```

# Use a python profiler

# Mystery program #3

# (really a mystery)

#

```
time python mystery_3.py
0.08user 1.03system 0:10.61elapsed 10%CPU
```

# demo demo

# we win

# your program <br> = <br> black box

# learn your operating system

# Thanks!

[`twitter.com/b0rk`][twitter] <br>
[`jvns.ca`][website] <br>
* twitter: @b0rk <br>
* blog: jvns.ca

[twitter]: https://twitter.com/b0rk
[website]: http://jvns.ca
Expand Down
17 changes: 9 additions & 8 deletions 2015-03-mtlpypracticetalk/template.revealjs
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Machine learning: the boring parts</title>
<title>debugging python without python</title>
<link rel="stylesheet" href="reveal_js/css/reveal.min.css">
<link rel="stylesheet" href="reveal_js/css/theme/moon.css" id="theme">
<link rel="stylesheet" href="reveal_js/css/theme/solarized.css" id="theme">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="reveal_js/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
Expand All @@ -27,15 +27,16 @@

.reveal pre.big {
font-family: andale mono;
font-size: 1.7em;
font-size: 1.4em;
line-height: 1.2em;
width: 1000px;
}

/*.reveal pre code {
// font-family: andale mono;
// font-size: 1.7em;
// line-height: 1.2em;
//}*/
.reveal pre code {
font-family: andale mono;
font-size: 1.3em;
line-height: 1.2em;
}

.reveal pre b {
color: yellow;
Expand Down

0 comments on commit 3752440

Please sign in to comment.