DTrace integration and quick start

Size: px
Start display at page:

Download "DTrace integration and quick start"

Transcription

1 DTrace integration and quick start rubsd Dec 2013 Veniamin Gvozdikov

2 What is DTrace? Dynamic tracing framework Works on Solaris/FreeBSD/OSX/QNX/Linux 2

3 Who uses it? Apple s Xcode Instruments Cloud Analytics in Joyent SmartDataCenter Oracle s ZFS Storage Appliance analytics Brendan s Flame Graphs Command line DTraceToolkit 3

4 Xcode Instruments 4

5 Cloud Analytics 5

6 Oracle s ZFS-SA analytics 6

7 Flame Graphs 7

8 DTraceToolkit 8

9 Terminology probe provider module 9

10 How it works? dtrace (1) libproc libdtrace /dev/dtrace user space DTrace kernel space 10

11 Providers dtrace: tcp: kernel space fbt: dtmalloc: io: lockstat: and others: syscall: profile: 11

12 dtrace(1) Command line frontend Shows available probes/providers Enable probes and attach to processes D Language compiler Works via libdtrace and libproc ETC 12

13 Available probes To see all probes on the system you need to run: # dtrace -l [ many lines ] To see probes by dtrace provider: # dtrace -l -n 'dtrace:::' ID PROVIDER MODULE FUNCTION NAME 1 dtrace BEGIN 2 dtrace END 3 dtrace ERROR 13

14 D program structure D language is like C and AWK: provider:module:function:probe / predicates / { action; 14

15 First D program # dtrace -q -n ' > syscall::open:entry { > printf("%s\t%s\n", execname, copyinstr(arg0)); > > profile:::tick-1s { > exit(0); > > ' tmux /dev/null sh /etc/libmap.conf sh /var/run/ld-elf.so.hints sh /lib/libedit.so.7 sh /lib/libncurses.so.8 sh /lib/libc.so.7 15

16 Built-in Variables (not all) args pid probeprov errno probefunc timestamp execname probemod vtimestamp 16

17 Aggregating Functions Function Name Arguments count sum avg min max lquantize quantize none scalar expression scalar expression scalar expression scalar expression scalar expression, lower bound, upper bound, step value scalar expression 17

18 Tracing applications Trace with pid provider Trace with USDT (Userland Statically Defined Traces) 18

19 DTrace integration examples Please clone repo (seeing code is required for next slides): 19

20 int length_fast(char *); int length_slow(char *); int main(void) { int counter = 0; int c_loop = 0; char *Lines[] = { "x", "tt", "Test", NULL ; char *line; printf("%10s %4s\n", "STRING", "LEN"); while (15 > c_loop) { while (NULL = Lines[counter]) { line = Lines[counter]; printf("%10s: %02d\n", line, length_fast(line)); printf("%10s: %02d\n", line, length_slow(line)); ++counter; ++c_loop; counter = 0; sleep(c_loop); return 0; 20

21 #00 pid provider 00_script.sh pid$target::length_*:entry { self->ts = timestamp; printf("string: %s\n", copyinstr(arg0)); 21

22 pid$target::length_*:return /self->ts/ = = sum(timestamp - = quantize(timestamp - self->ts); self->ts = 0; profile:::tick-10sec { exit(0); 22

23 END { printf("count of call functions:\n"); printa(@num); printf("time of call functions:\n"); printa(@sum); printf("distribution of times by functions:\n"); printa(@q); 23

24 result Count of call functions: length_fast 6 length_slow 6 Time of call functions: length_fast length_slow Distribution of times by functions: length_fast value Distribution count length_slow value Distribution count

25 #01 First USDT provider dtrace_demo.d: provider demo { probe start(); probe stop(); ; Generate header file: # dtrace -h -s dtrace_demo.d 25

26 #01 Adding probes while (1) { if (DEMO_START_ENABLED()) DEMO_START(); while (NULL = Lines[counter]) { [ lines ] counter = 0; sleep(1); if (DEMO_STOP_ENABLED()) DEMO_STOP(); 26

27 Compile applications Make object file: # clang -c main.c -DENABLE_DTRACE Run dtrace(1) on object file: # dtrace -G -s dtrace_demo.d main.o Link objects to application: # clang -lelf main.o dtrace_demo.o -o demo 27

28 #01 Trace application 01_script.sh #/usr/sbin/dtrace -Zs #pragma D option quiet demo*:::start { self->ts = timestamp; demo*:::stop { printf("time: %d\n", timestamp - self->ts); self->ts = 0; result # scripts/01_script.sh time: time: time: time: time: time: time: time: time: time:

29 #02 Probes with arguments dtrace_demo.d: provider demo { probe start(char *); probe stop(int); ; Generate header file: # dtrace -h -s dtrace_demo.d 29

30 #02 Adding probes int length_fast(char *string) { int i; if (DEMO_START_ENABLED()) DEMO_START(string); for (i = 0; '\0' = *string; ++i) { ++string; if (DEMO_STOP_ENABLED()) DEMO_STOP(i); return i; int length_slow(char *string) { int i; if (DEMO_START_ENABLED()) DEMO_START(string); 30 for (i = 0; '\0' = *string; ++i) { ++string; usleep(i*i); if (DEMO_STOP_ENABLED()) DEMO_STOP(i); return i;

31 #/usr/sbin/dtrace -Zs #pragma D option quiet BEGIN { self->start = timestamp; self->ts = 0; printf("start tracing...\n\n"); demo*:::start { self->ts = timestamp; printf("string: %10s ", copyinstr(arg0)); demo*:::stop /self->ts/ { printf("len: %2d time: %6d \n", arg0, timestamp - = quantize((timestamp - self->ts) / 1000); self->ts = 0; END { printf("time %d.%d sec\n", (timestamp - self->start)/1000/1000/1000, (timestamp - self->start)/1000/1000/100); 31

32 result # scripts/02_script.sh Start tracing... String: tt len: 2 time: String: Test len: 4 time: 5131 String: Test len: 4 time: String: x len: 1 time: String: x len: 1 time: String: tt len: 2 time: 4949 String: x len: 1 time: String: x len: 1 time: 8848 String: tt len: 2 time: 4430 String: tt len: 2 time: String: Test len: 4 time: 4561 String: Test len: 4 time: ^C Time sec [ skipped distributions ] 32

33 #03 Evolution interface dtrace_demo.d: typedef struct { int dummy; dline_t; typedef struct { int dummy; demo_t; provider demo { probe start(); probe stop(dline_t *dp) : (demo_t *dp); ; #pragma D attributes Evolving/Evolving/ISA provider demo provider #pragma D attributes Private/Private/Unknown provider demo module #pragma D attributes Private/Private/Unknown provider demo function #pragma D attributes Private/Private/ISA provider demo name #pragma D attributes Evolving/Evolving/ISA provider demo args 33

34 #03 Fill structure demo_provider.h: typedef struct { const char *mystr; int len; dline_t; int length_fast(char *string) { dline_t data; int i; if (DEMO_START_ENABLED()) { data.mystr = string; DEMO_START(); [ some action ] if (DEMO_STOP_ENABLED()) { data.len = i; DEMO_STOP(&data); return i; 34

35 #03 First DTrace library demo.d: typedef struct { char *mystr; int len; dline_t; copy demo.d to /usr/lib/dtrace or run: typedef struct { string str; int len; demo_t; #pragma D binding "1.7" translator translator demo_t < dline_t *p > { str = copyinstr(*(uintptr_t *)copyin((uintptr_t)&p->mystr, sizeof (char*))); len = *(uint64_t *)copyin((uintptr_t)&p->len, sizeof (p->len)); ; # dtrace -L /path/to/dtrace/libs some args 35

36 #03 Access to structure 03_script.sh: demo*:::stop /self->ts/ { printf("string: %10s len: %2d time: %6d\n", args[0]->str, args[0]->len, timestamp - = quantize((timestamp - self->ts) / 1000); self->ts = 0; 36

37 result # scripts/03_script.sh Start tracing... String: x len: 1 time: 5178 String: x len: 1 time: 3485 String: tt len: 2 time: 1415 String: tt len: 2 time: String: Test len: 4 time: 1673 String: Test len: 4 time: ^C Time 2.20 sec [ skipped distributions ] 37

38 libusdt Creates DTrace probes at runtime Bindings to Lua/Ruby/node.js/Perl 38

39 libusdt and tarantool Please clone repo recursively from dtrace branch: See README.DTrace for more details 39

40 lua usdt init.lua: provider = usdt.provider("init_script", "tarantool_box") probe = provider:probe("dt_hello", "entry", "char *", "int") provider:enable() function dt_hello(mystr) probe:fire(mystr, string.len(mystr)) end 40

41 Example # dtrace -l -n 'init_script*:::' ID PROVIDER MODULE FUNCTION NAME init_script18132 tarantool_box dt_hello entry localhost> for _, val in ipairs({"test", "tt", "xxx") do dt_hello(val) end # dtrace -q -n 'init_script*:::entry { printf("string %10s len: %02d\n", copyinstr(arg0), arg1) tick-2s {exit(0);' String Test len: 04 String tt len: 02 String xxx len: 03 41

42 References

DTrace for Linux. Tomas Jedlicka Sat

DTrace for Linux. Tomas Jedlicka Sat DTrace for Linux Tomas Jedlicka 2018-02-03 Sat Introduction Overview DTrace has been released in 2005 for Sun s Solaris operating system. Today it has become adopted by other

More information

DTrace for Web2.0 JavaScript, PHP and Coolstack (SAMP) Philip Torchinsky Solaris Evangelist Sun Microsystems

DTrace for Web2.0 JavaScript, PHP and Coolstack (SAMP) Philip Torchinsky Solaris Evangelist Sun Microsystems DTrace for Web2.0 JavaScript, PHP and Coolstack (SAMP) Philip Torchinsky Solaris Evangelist Sun Microsystems 1 Agenda Why should you care?? Introduction to DTrace DTrace and JavaScript DTrace on the BackEnd

More information

Introduction to using DTrace with MySQL. Vince Carbone Performance Technology Group, Sun MC Brown - MySQL

Introduction to using DTrace with MySQL. Vince Carbone Performance Technology Group, Sun MC Brown - MySQL Introduction to using DTrace with MySQL Vince Carbone Performance Technology Group, Sun MC Brown - MySQL Agenda Quick DTrace Overview Tracing User Applications User Process Tracing Case Study MySQL Static

More information

Contents. Part I Introduction. Acknowledgments About the Authors. Chapter 1 Introduction to DTrace 1

Contents. Part I Introduction. Acknowledgments About the Authors. Chapter 1 Introduction to DTrace 1 Gregg.book Page v Wednesday, February 2, 2011 12:35 PM Foreword Preface Acknowledgments About the Authors xxi xxv xxxi xxxv Part I Introduction Chapter 1 Introduction to DTrace 1 What Is DTrace? 1 Why

More information

Deep-inspecting MySQL with DTrace. Domas Mituzas, Sun Microsystems

Deep-inspecting MySQL with DTrace. Domas Mituzas, Sun Microsystems Deep-inspecting MySQL with DTrace Domas Mituzas, Sun Microsystems Me MySQL Senior Support Engineer @ Sun Doing performance engineering for Wikipedia, develop performance accounting tools Don t like waste

More information

Performance Tuning Linux Applications With DTrace

Performance Tuning Linux Applications With DTrace Performance Tuning Linux Applications With DTrace Adam Leventhal Solaris Kernel Development Sun Microsystems http://blogs.sun.com/ahl Application Sprawl Applications are no longer simple entities Complex

More information

DTrace and Java TM Technology: Taking Observability to the Next Dimension

DTrace and Java TM Technology: Taking Observability to the Next Dimension DTrace and Java TM Technology: Taking Observability to the Next Dimension Jonathan Haslam Simon Ritter Sun Microsystems Presentation Goal Learn how to use DTrace providers to gain more insight into why

More information

DTrace & MySQL. MySQL Users Conference Ben Rockwood Director of Systems Joyent

DTrace & MySQL. MySQL Users Conference Ben Rockwood Director of Systems Joyent DTrace & MySQL MySQL Users Conference 2008 Ben Rockwood Director of Systems Joyent DTrace Dynamic Tracing Framework The ultimate observability tool. Created by Sun for Solaris 10 Open Source! (CDDL License)

More information

Mestrado Informática CPD/ESC 2016/2017

Mestrado Informática CPD/ESC 2016/2017 CPD/ESC 2016/2017 DTrace Lab exercises DTraceis a comprehensive dynamic tracing framework for the Solaris Operating Environment. It provides a powerful infrastructure to permit administrators, developers,

More information

Erlang-DTrace. Garry Bulmer. Team DTrace: Tim Becker

Erlang-DTrace. Garry Bulmer. Team DTrace: Tim Becker Erlang-DTrace Garry Bulmer Team DTrace: Tim Becker What I'm going to talk about Introduction to DTrace & DTrace Architecture Demo of DTrace with one liners Erlang + Dtrace =? Erlang VM Architecture Current

More information

Profiling Applications!!! Mark using DTrace!

Profiling Applications!!! Mark     using DTrace! Profiling Applications!!! Mark Allen! mrallen1@yahoo.com! @bytemeorg! https://github.com/mrallen1! https://speakerdeck.com/mrallen1! using DTrace! What is DTrace?! DTrace Basics Dynamic Tracing! DTrace

More information

DTrace Topics: Introduction

DTrace Topics: Introduction # dtrace -n 'syscall:::entry { @[exe dtrace: description 'syscall:::entry ^C DTrace Topics: Introduction Brendan Gregg Sun Microsystems April 2007 iscsitgtd 1 nscd 1 operapluginclean 3 screen-4.0.2 3 devfsadm

More information

Everyday DTrace on OSX. A talk by Scott Barron and Chad Humphries on the most visceral learnings of the DTrace tongue.

Everyday DTrace on OSX. A talk by Scott Barron and Chad Humphries on the most visceral learnings of the DTrace tongue. Everyday DTrace on OSX A talk by Scott Barron and Chad Humphries on the most visceral learnings of the DTrace tongue. The DTrace Team Prey tell, good sir what does it do? Tune and Troubleshoot in real

More information

DTrace Topics: Java. Brendan Gregg Sun Microsystems March 2007

DTrace Topics: Java. Brendan Gregg Sun Microsystems March 2007 DTrace Topics: Java Brendan Gregg Sun Microsystems March 2007 #./jflow.d Greeting.greet -> java/io/printstream.println -> java/io/printstream.print -> java/io/printstream.write

More information

Oracle Linux. DTrace Guide

Oracle Linux. DTrace Guide Oracle Linux DTrace Guide E38608-21 November 2018 Oracle Legal Notices Copyright 2013, 2018, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under

More information

Kernels and Tracing. Reminder: last time. What is an operating system? Systems research About the module Lab reports 10/27/16

Kernels and Tracing. Reminder: last time. What is an operating system? Systems research About the module Lab reports 10/27/16 Kernels and Tracing L41 Lecture 2 Dr Robert N. M. Watson 27 October 2016 Reminder: last time What is an operating system? Systems research About the module Lab reports L41 Lecture 2 - Kernels and Tracing

More information

Code Instrumentation, Dynamic Tracing

Code Instrumentation, Dynamic Tracing Code Instrumentation, Dynamic Tracing http://d3s.mff.cuni.cz/aosy http://d3s.mff.cuni.cz Martin Děcký decky@d3s.mff.cuni.cz Observability What is the system doing? Beyond the obvious (externally visible

More information

Real-time node.js: Instrumentation, Visualization & Debugging. Bryan Cantrill SVP,

Real-time node.js: Instrumentation, Visualization & Debugging. Bryan Cantrill SVP, Real-time node.js: Instrumentation, Visualization & Debugging Bryan Cantrill SVP, Engineering bryan@joyent.com @bcantrill Real-time web? The term has enjoyed some popularity, but there is clearly confusion

More information

Xcode. ARC, Instruments, DTrace. OSXDEV.org.

Xcode. ARC, Instruments, DTrace. OSXDEV.org. Xcode ARC, Instruments, DTrace OSXDEV.org twitter.com/@godrm Scheme Single Window Multi-window & Multi-tab Version Editor Visual Connections (IB) LLVM Compiler Workspace Fix-it & Live issue Navigators

More information

L41: Kernels and Tracing

L41: Kernels and Tracing L41: Kernels and Tracing Dr Robert N. M. Watson 15 October 2015 Dr Robert N. M. Watson L41: Kernels and Tracing 15 October 2015 1 / 23 Introduction Reminder: last time 1. What is an operating system? 2.

More information

Leveraging DTrace for runtime verification

Leveraging DTrace for runtime verification Leveraging DTrace for runtime verification Carl Martin Rosenberg June 7th, 2016 Department of Informatics, University of Oslo Context: Runtime verification Desired properties System Every request gets

More information

Quick Introduction to ebpf & BCC Suchakrapani Sharma. Kernel Meetup (Reserved Bit, Pune)

Quick Introduction to ebpf & BCC Suchakrapani Sharma. Kernel Meetup (Reserved Bit, Pune) Quick Introduction to ebpf & BCC Suchakrapani Sharma Kernel Meetup (Reserved Bit, Pune) 24 th June 2017 ebpf Stateful, programmable, in-kernel decisions for networking, tracing and security One Ring by

More information

Tuning Parallel Code on Solaris Lessons Learned from HPC

Tuning Parallel Code on Solaris Lessons Learned from HPC Tuning Parallel Code on Solaris Lessons Learned from HPC Dani Flexer dani@daniflexer.com Presentation to the London OpenSolaris User Group Based on a Sun White Paper of the same name published 09/09 23/9/2009

More information

struct A { int a; char *b; union { void *addr; uint64_t val; }; };

struct A { int a; char *b; union { void *addr; uint64_t val; }; }; PRETTY PRINTING STRUCTURES USING CLANG CLANG BUILTIN IMPLEMENTATION PAUL SEMEL WHAT'S THE EXPECTED RESULT? struct A { int a; char *b; union { void *addr; uint64_t val; }; }; struct A obj = {.a = 12,.b

More information

Structures, Unions Alignment, Padding, Bit Fields Access, Initialization Compound Literals Opaque Structures Summary. Structures

Structures, Unions Alignment, Padding, Bit Fields Access, Initialization Compound Literals Opaque Structures Summary. Structures Structures Proseminar C Grundlagen und Konzepte Michael Kuhn Research Group Scientific Computing Department of Informatics Faculty of Mathematics, Informatics und Natural Sciences University of Hamburg

More information

L41: Kernels and Tracing

L41: Kernels and Tracing L41: Kernels and Tracing Dr Robert N. M. Watson 25 February 2015 Dr Robert N. M. Watson L41: Kernels and Tracing 25 February 2015 1 / 1 Introduction Reminder: last time 1. What is an operating system?

More information

MIDTERM EXAM. CS 217 October 28, Name: Precept: Honor Code: Score: Problem Score Max

MIDTERM EXAM. CS 217 October 28, Name: Precept: Honor Code: Score: Problem Score Max MIDTERM EXAM CS 217 October 28, 1999 Name: Precept: Honor Code: Score: Problem Score Max 1 15 2 5 3 10 4 15 5 5 6 10 7 10 Total 70 1 1. Number Systems (a) Translate the following decimal numbers to binary,

More information

SOFTWARE Ph.D. Qualifying Exam Spring Consider the following C program which consists of two function definitions including the main function.

SOFTWARE Ph.D. Qualifying Exam Spring Consider the following C program which consists of two function definitions including the main function. (i) (5 pts.) SOFTWARE Ph.D. Qualifying Exam Spring 2018 Consider the following C program which consists of two function definitions including the main function. #include int g(int z) { int y

More information

DTrace Topics: DTraceToolkit

DTrace Topics: DTraceToolkit #pragma D option quiet #pragma D option switchrate=10hz /* * Print header */ dtrace:::begin { /* print optional headers */ OPT_time? printf("%-14s ", " OPT_timestr? printf("%-20s ", " OPT_zone? printf("%-10s

More information

DTrace. Crash Dump Analysis 2014/2015. CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics.

DTrace. Crash Dump Analysis 2014/2015. CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics. DTrace http://d3s.mff.cuni.cz Crash Dump Analysis 2014/2015 CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics DTrace Dynamic Tracing Production systems observability Safety Ideally zero overhead

More information

Using DTrace API to write my own consumer

Using DTrace API to write my own consumer Using DTrace API to write my own consumer Petr Škovroň Solaris RPE Sun Microsystems Czech petr.skovron@sun.com Jun 27, 2008 Contents Introduction Compilation and execution the DTrace script Reading the

More information

Oracle Linux. DTrace Tutorial

Oracle Linux. DTrace Tutorial Oracle Linux DTrace Tutorial E50705-10 October 2018 Oracle Legal Notices Copyright 2013, 2018, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under

More information

DTrace by Example: Solving a Real-World Problem. Paul van den Bogaard January 2007 Sun Microsystems, Inc.

DTrace by Example: Solving a Real-World Problem. Paul van den Bogaard January 2007 Sun Microsystems, Inc. DTrace by Example: Solving a Real-World Problem Paul van den Bogaard January 2007 Sun Microsystems, Inc. Copyright 2007 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.

More information

Oracle Linux. DTrace Guide

Oracle Linux. DTrace Guide Oracle Linux DTrace Guide E38608-18 August 2017 Oracle Legal Notices Copyright 2013, 2017, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under

More information

CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community

CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu History and Evolution of Programming Languages 1. Explain the relationship between machine

More information

RALPH BÖHME, SERNET, SAMBA TEAM UNDERSTANDING AND IMPROVING SAMBA FILESERVER PERFORMANCE HOW I FELL IN LOVE WITH SYSTEMTAP AND PERF

RALPH BÖHME, SERNET, SAMBA TEAM UNDERSTANDING AND IMPROVING SAMBA FILESERVER PERFORMANCE HOW I FELL IN LOVE WITH SYSTEMTAP AND PERF UNDERSTANDING AND IMPROVING HOW I FELL IN LOVE WITH SYSTEMTAP AND PERF 2 AGENDA Disclaimer: focus on userspace, not kernel, mostly Linux Linux tracing history tour de force perf Systemtap Samba fileserver

More information

#include <stdio.h> int main() { char s[] = Hsjodi, *p; for (p = s + 5; p >= s; p--) --*p; puts(s); return 0;

#include <stdio.h> int main() { char s[] = Hsjodi, *p; for (p = s + 5; p >= s; p--) --*p; puts(s); return 0; 1. Short answer questions: (a) Compare the typical contents of a module s header file to the contents of a module s implementation file. Which of these files defines the interface between a module and

More information

Instrumenting the real-time web: Node.js, DTrace and the Robinson Projection

Instrumenting the real-time web: Node.js, DTrace and the Robinson Projection Instrumenting the real-time web: Node.js, DTrace and the Robinson Projection Bryan Cantrill VP, Engineering bryan@joyent.com @bcantrill Node.js node.js is a JavaScript-based framework for building event-oriented

More information

ECE 435 Network Engineering Lecture 2

ECE 435 Network Engineering Lecture 2 ECE 435 Network Engineering Lecture 2 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 6 September 2018 Announcements Homework 1 will be posted. Will be on website, will announce

More information

C BOOTCAMP DAY 2. CS3600, Northeastern University. Alan Mislove. Slides adapted from Anandha Gopalan s CS132 course at Univ.

C BOOTCAMP DAY 2. CS3600, Northeastern University. Alan Mislove. Slides adapted from Anandha Gopalan s CS132 course at Univ. C BOOTCAMP DAY 2 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Pointers 2 Pointers Pointers are an address in memory Includes variable addresses,

More information

DTracing the Cloud. Brendan Gregg Lead Performance October, Monday, October 1, 12

DTracing the Cloud. Brendan Gregg Lead Performance October, Monday, October 1, 12 DTracing the Cloud Brendan Gregg Lead Performance Engineer brendan@joyent.com @brendangregg October, 2012 DTracing the Cloud whoami G Day, I m Brendan These days I do performance analysis of the cloud

More information

The University of Nottingham

The University of Nottingham The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, AUTUMN SEMESTER 2008 2009 C/C++ for Java Programmers Time allowed TWO hours Candidates may complete the front cover of their answer

More information

Erlang-DTrace. Garry Bulmer. Team DTrace: Tim Becker

Erlang-DTrace. Garry Bulmer. Team DTrace: Tim Becker Erlang-DTrace Garry Bulmer Team DTrace: Tim Becker What I'm going to talk about Introduction to DTrace & DTrace Architecture Demo of DTrace with one liners Erlang-Dtrace Vision & Fit Erlang VM Architecture

More information

Flame Graphs on FreeBSD

Flame Graphs on FreeBSD FreeBSD Developer and Vendor Summit, Nov, 2014 Flame Graphs on FreeBSD Brendan Gregg Senior Performance Architect Performance Engineering Team bgregg@ne5lix.com @brendangregg Agenda 1. Genesis 2. Genera=on

More information

ECE 435 Network Engineering Lecture 2

ECE 435 Network Engineering Lecture 2 ECE 435 Network Engineering Lecture 2 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 31 August 2017 Announcements Homework 1 will be posted. Will be on website, will announce

More information

Kurt Schmidt. October 30, 2018

Kurt Schmidt. October 30, 2018 to Structs Dept. of Computer Science, Drexel University October 30, 2018 Array Objectives to Structs Intended audience: Student who has working knowledge of Python To gain some experience with a statically-typed

More information

Proceedings of the General Track: 2004 USENIX Annual Technical Conference

Proceedings of the General Track: 2004 USENIX Annual Technical Conference USENIX Association Proceedings of the General Track: 2004 USENIX Annual Technical Conference Boston, MA, USA June 27 July 2, 2004 2004 by The USENIX Association All Rights Reserved For more information

More information

Process Concept: views of a process Process Scheduling CSCI 6730/ 4730 Operating Systems

Process Concept: views of a process Process Scheduling CSCI 6730/ 4730 Operating Systems Chapter 3: Processes: Outline Process Concept: views of a process Process Scheduling CSCI 6730/ 4730 Operating Systems Operations on Processes Cooperating Processes Inter Process Communication (IPC) RPC:

More information

Structures. Basics of Structures (6.1) EECS l Now struct point is a valid type. l Defining struct variables: struct point { int x; int y; };

Structures. Basics of Structures (6.1) EECS l Now struct point is a valid type. l Defining struct variables: struct point { int x; int y; }; Structures EECS 2031 25 September 2017 1 Basics of Structures (6.1) struct point { int x; int y; keyword struct introduces a structure declaration. point: structure tag x, y: members The same member names

More information

Dynamic Tracing and Instrumentation

Dynamic Tracing and Instrumentation Dynamic Tracing and Instrumentation Bryan Cantrill and Mike Shapiro (bmc, mws@eng.sun.com) Solaris Kernel Group Kernel Debugging Today if (no_advanced_debugging) printf(9f) ASSERT(i_am_a_debug_kernel!=

More information

ECE264 Spring 2014 Exam 2, March 11, 2014

ECE264 Spring 2014 Exam 2, March 11, 2014 ECE264 Spring 2014 Exam 2, March 11, 2014 In signing this statement, I hereby certify that the work on this exam is my own and that I have not copied the work of any other student while completing it.

More information

ECE 15B COMPUTER ORGANIZATION

ECE 15B COMPUTER ORGANIZATION ECE 15B COMPUTER ORGANIZATION Lecture 13 Strings, Lists & Stacks Announcements HW #3 Due next Friday, May 15 at 5:00 PM in HFH Project #2 Due May 29 at 5:00 PM Project #3 Assigned next Thursday, May 19

More information

Advanced DTrace. Tips, Tricks and Gotchas. Bryan Cantrill, Mike Shapiro and Adam Leventhal Team DTrace

Advanced DTrace. Tips, Tricks and Gotchas. Bryan Cantrill, Mike Shapiro and Adam Leventhal Team DTrace Advanced DTrace Tips, Tricks and Gotchas Bryan Cantrill, Mike Shapiro and Adam Leventhal Team DTrace Advanced DTrace Assumption that the basics of DTrace are understood or at least familiar You need not

More information

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems

Programs. Function main. C Refresher. CSCI 4061 Introduction to Operating Systems Programs CSCI 4061 Introduction to Operating Systems C Program Structure Libraries and header files Compiling and building programs Executing and debugging Instructor: Abhishek Chandra Assume familiarity

More information

Function Binding. Special thanks to: John Edwards. Randy Gaul

Function Binding. Special thanks to: John Edwards. Randy Gaul Function Binding Special thanks to: John Edwards Randy Gaul Introspection Generic Variable Function Binding Simple Case Uses Demo Overview Function Binding Introspection Run-time knows little about types

More information

ECE264 Fall 2013 Exam 3, November 20, 2013

ECE264 Fall 2013 Exam 3, November 20, 2013 ECE264 Fall 2013 Exam 3, November 20, 2013 In signing this statement, I hereby certify that the work on this exam is my own and that I have not copied the work of any other student while completing it.

More information

Floating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions

Floating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions Announcements Thursday Extras: CS Commons on Thursdays @ 4:00 pm but none next week No office hours next week Monday or Tuesday Reflections: when to use if/switch statements for/while statements Floating-point

More information

Fall 2015 COMP Operating Systems. Lab #3

Fall 2015 COMP Operating Systems. Lab #3 Fall 2015 COMP 3511 Operating Systems Lab #3 Outline n Operating System Debugging, Generation and System Boot n Review Questions n Process Control n UNIX fork() and Examples on fork() n exec family: execute

More information

Breaking Down MySQL/Percona Query Latency With DTrace

Breaking Down MySQL/Percona Query Latency With DTrace Breaking Down MySQL/Percona Query Latency With DTrace Brendan Gregg Lead Performance Engineer, Joyent Percona Live, May 2011 Agenda DTrace and Dynamic Tracing Latency and Query Latency Query Latency Components

More information

ECE264 Fall 2013 Exam 2, October 24, 2013

ECE264 Fall 2013 Exam 2, October 24, 2013 ECE Fall 0 Exam, October, 0 If this is an on-line exam, you have 0 minutes to finish the exam. When the time limit is reached, the system will automatically close. If this is a paper exam, you have 0 minutes.

More information

Project 1 System Calls

Project 1 System Calls Project 1 System Calls Introduction In this project, you will become familiar with: 1. Using the xv6 Makefile 2. Using conditional compilation. 3. The xv6 system call invocation path. 4. Implementing a

More information

Outline. Basic features of BPF virtual machine

Outline. Basic features of BPF virtual machine Outline 10 Seccomp 10-1 10.1 Introduction and history 10-3 10.2 Seccomp filtering and BPF 10-11 10.3 Constructing seccomp filters 10-16 10.4 BPF programs 10-30 10.5 Further details on seccomp filters 10-47

More information

Introduction. This project will focus primarily on processes.

Introduction. This project will focus primarily on processes. Project 2 Processes Introduction This project will focus primarily on processes. In this project, you will become familiar with: 1. Locks for kernel-level data structures; concurrency. 2. Implementing

More information

Dynamic Tracing for Exploitation and Fuzzing

Dynamic Tracing for Exploitation and Fuzzing ~ Aloha! ~ Dynamic Tracing for Exploitation and Fuzzing SHAKACON 2009 Tiller Beauchamp IOActive [ David Weston ] DTrace Background Kernel-based dynamic tracing framework Created by Sun Microsystems First

More information

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

More information

Programming in C. Lecture 9: Tooling. Dr Neel Krishnaswami. Michaelmas Term

Programming in C. Lecture 9: Tooling. Dr Neel Krishnaswami. Michaelmas Term Programming in C Lecture 9: Tooling Dr Neel Krishnaswami Michaelmas Term 2017-2018 1 / 24 Undefined and Unspecified Behaviour 2 / 24 Undefined and Unspecified Behaviour We have seen that C is an unsafe

More information

CS 61C: Great Ideas in Computer Architecture. Lecture 3: Pointers. Bernhard Boser & Randy Katz

CS 61C: Great Ideas in Computer Architecture. Lecture 3: Pointers. Bernhard Boser & Randy Katz CS 61C: Great Ideas in Computer Architecture Lecture 3: Pointers Bernhard Boser & Randy Katz http://inst.eecs.berkeley.edu/~cs61c Agenda Pointers in C Arrays in C This is not on the test Pointer arithmetic

More information

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto Adapted from the slides Revisões sobre Programação em C, Sérgio Crisóstomo Compilation #include int main()

More information

Storage class and Scope:

Storage class and Scope: Algorithm = Logic + Control + Data Data structures and algorithms Data structures = Ways of systematically arranging information, both abstractly and concretely Algorithms = Methods for constructing, searching,

More information

CS349/SE382 A1 C Programming Tutorial

CS349/SE382 A1 C Programming Tutorial CS349/SE382 A1 C Programming Tutorial Erin Lester January 2005 Outline Comments Variable Declarations Objects Dynamic Memory Boolean Type structs, enums and unions Other Differences The Event Loop Comments

More information

Know your Unknowns. Techniques for analyzing unknown software. (and dynamic reversing in general)

Know your Unknowns. Techniques for analyzing unknown software. (and dynamic reversing in general) Know your Unknowns Techniques for analyzing unknown software (and dynamic reversing in general) The Problem Presented with a new software sample, how do we determine: What does it do? How does it do it?

More information

Dynamic Tracing and the DTrace book

Dynamic Tracing and the DTrace book Dynamic Tracing and the DTrace book Brendan Gregg Lead Performance Engineer, Joyent BayLISA, May 2011 Agenda Dynamic Tracing DTrace Latency Performance IntrospecDon of Cloud CompuDng DTrace Book Please

More information

CS61C Machine Structures. Lecture 4 C Structs & Memory Management. 9/5/2007 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/

CS61C Machine Structures. Lecture 4 C Structs & Memory Management. 9/5/2007 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/ CS61C Machine Structures Lecture 4 C Structs & Memory Management 9/5/2007 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L04 C Structs (1) C String Standard Functions

More information

BSM540 Basics of C Language

BSM540 Basics of C Language BSM540 Basics of C Language Chapter 9: Functions I Prof. Manar Mohaisen Department of EEC Engineering Review of the Precedent Lecture Introduce the switch and goto statements Introduce the arrays in C

More information

NOTE: Debug and DebugSingle are the only MPI library configurations that will produce trace output.

NOTE: Debug and DebugSingle are the only MPI library configurations that will produce trace output. Trace Objects Trace Objects Introduction Use the Trace module to selectively produce trace output on a global and/or per-object basis for your application. You can specify the types of trace output when

More information

A Fast Review of C Essentials Part I

A Fast Review of C Essentials Part I A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types

More information

The course that gives CMU its Zip! Concurrency I: Threads April 10, 2001

The course that gives CMU its Zip! Concurrency I: Threads April 10, 2001 15-213 The course that gives CMU its Zip! Concurrency I: Threads April 10, 2001 Topics Thread concept Posix threads (Pthreads) interface Linux Pthreads implementation Concurrent execution Sharing data

More information

Solaris kernel thread stack usage

Solaris kernel thread stack usage Solaris kernel thread stack usage Context: this document proposes to add a new kmem_stackinfo variable to Solaris kernel for a new feature that gives informations about the kernel thread stack usage through

More information

G52CPP C++ Programming Lecture 12

G52CPP C++ Programming Lecture 12 G52CPP C++ Programming Lecture 12 Dr Jason Atkin http://www.cs.nott.ac.uk/~jaa/cpp/ g52cpp.html 1 Last lecture this and static members References Act like pointers Look like values More const And mutable

More information

Introduction to N1031. Components of N1031. Guiding Principles. Walk through, issues, and rationale

Introduction to N1031. Components of N1031. Guiding Principles. Walk through, issues, and rationale Introduction to N1031 Walk through, issues, and rationale Components of N1031 New functions that protect against buffer overflow and always produce null terminated strings New reentrant versions of old

More information

Discussion of Assignments 2. Line buffered vs. full buffered I/O. Some often encountered issues in the submissions.

Discussion of Assignments 2. Line buffered vs. full buffered I/O. Some often encountered issues in the submissions. 3 4 Discussion of Assignment 1 Discussion of Assignments 1 and 2 Accompanying Tutorial to Operating Systems Course Alexander Holupirek, Stefan Klinger Database and Information Systems Group Department

More information

Chapter 3: Processes: Outline. Operating Systems. Remote Procedure Calls (RPC) Client-Server Remote Machine Communication Mechanisms

Chapter 3: Processes: Outline. Operating Systems. Remote Procedure Calls (RPC) Client-Server Remote Machine Communication Mechanisms Chapter 3: Processes: Outline Operating Systems RPC: Processes Process Concept: views of a process Process Scheduling Operations on Processes Cooperating Processes Inter Process Communication (IPC) Local

More information

Computer Systems Assignment 2: Fork and Threads Package

Computer Systems Assignment 2: Fork and Threads Package Autumn Term 2018 Distributed Computing Computer Systems Assignment 2: Fork and Threads Package Assigned on: October 5, 2018 Due by: October 12, 2018 1 Understanding fork() and exec() Creating new processes

More information

DTrace User Guide. Sun Microsystems, Inc Network Circle Santa Clara, CA U.S.A.

DTrace User Guide. Sun Microsystems, Inc Network Circle Santa Clara, CA U.S.A. DTrace User Guide Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 819 5488 10 May 2006 Copyright 2006 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA95054 U.S.A.

More information

COMP322 - Introduction to C++ Lecture 02 - Basics of C++

COMP322 - Introduction to C++ Lecture 02 - Basics of C++ COMP322 - Introduction to C++ Lecture 02 - Basics of C++ School of Computer Science 16 January 2012 C++ basics - Arithmetic operators Where possible, C++ will automatically convert among the basic types.

More information

CGS 3460 Summer 07 Midterm Exam

CGS 3460 Summer 07 Midterm Exam Short Answer 3 Points Each 1. What would the unix command gcc somefile.c -o someotherfile.exe do? 2. Name two basic data types in C. 3. A pointer data type holds what piece of information? 4. This key

More information

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

Hint #1. Define a syscall

Hint #1. Define a syscall PC 5 System call Exercice Clone the git repository git clone http://gitlab.montefiore.ulg.ac.be/info0940/kernel-4.4.50.git Make a "PC4" branch Add a sys_forkexec system call It is the equivalent of calling

More information

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1 Reading Assignment 4 Chapter 4 Threads, due 2/7 1/31/13 CSE325 - Processes 1 What s Next? 1. Process Concept 2. Process Manager Responsibilities 3. Operations on Processes 4. Process Scheduling 5. Cooperating

More information

High Performance Computing in C and C++

High Performance Computing in C and C++ High Performance Computing in C and C++ Rita Borgo Computer Science Department, Swansea University Summary Introduction to C Writing a simple C program Compiling a simple C program Running a simple C program

More information

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

Reference slides! C Strings! A string in C is just an array of characters.!!!char string[] = "abc";! How do you tell how long a string is?!

Reference slides! C Strings! A string in C is just an array of characters.!!!char string[] = abc;! How do you tell how long a string is?! CS61C L04 Introduction to C (pt 2) (1)! Reference slides! C Strings! You ARE responsible for the material on these slides (they re just taken from the reading anyway). These were the slides that generated

More information

Kernel debugging "tricks" wasn't my idea

Kernel debugging tricks wasn't my idea Kernel debugging "tricks" wasn't my idea 1 panic("why am I talking?"); 2 Problems? panic("why am I talking?"); What is the problem with this panic message? 3 Problem 1 panic("why am I talking?"); Who am

More information

Administrivia. Introduction to Computer Systems. Pointers, cont. Pointer example, again POINTERS. Project 2 posted, due October 6

Administrivia. Introduction to Computer Systems. Pointers, cont. Pointer example, again POINTERS. Project 2 posted, due October 6 CMSC 313 Introduction to Computer Systems Lecture 8 Pointers, cont. Alan Sussman als@cs.umd.edu Administrivia Project 2 posted, due October 6 public tests s posted Quiz on Wed. in discussion up to pointers

More information

DTrace User Guide Part No: May 2006

DTrace User Guide Part No: May 2006 DTrace User Guide Part No: 819 5488 10 May 2006 Copyright 2006Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Sun Microsystems, Inc. has intellectual property rights relating to

More information

Signature: ECE 551 Midterm Exam

Signature: ECE 551 Midterm Exam Name: ECE 551 Midterm Exam NetID: There are 7 questions, with the point values as shown below. You have 75 minutes with a total of 75 points. Pace yourself accordingly. This exam must be individual work.

More information

SOFTWARE Ph.D. Qualifying Exam Fall 2017

SOFTWARE Ph.D. Qualifying Exam Fall 2017 (i) (4 pts.) SOFTWARE Ph.D. Qualifying Exam Fall 2017 Consider the following C program. #include #define START 2 #define LIMIT 60 #define STEP 7 #define SIZE 3 int main(void) { int i = START,

More information

An application: foreign function bindings

An application: foreign function bindings 1/ 19 An application: foreign function bindings C int puts ( const char *s); 2/ 19 C in two minutes object types numeric types int, char, float,... pointers int *, char *, int **,... structures and unions

More information

pthreads CS449 Fall 2017

pthreads CS449 Fall 2017 pthreads CS449 Fall 2017 POSIX Portable Operating System Interface Standard interface between OS and program UNIX-derived OSes mostly follow POSIX Linux, macos, Android, etc. Windows requires separate

More information

Programming. Structures, enums and unions

Programming. Structures, enums and unions Programming Structures, enums and unions Summary } Structures } Declaration } Member access } Function arguments } Memory layout } Array of structures } Typedef } Enums } Unions 2 Idea! } I want to describe

More information