Use Dynamic Analysis Tools on Linux
|
|
- Ethel Strickland
- 6 years ago
- Views:
Transcription
1 Use Dynamic Analysis Tools on Linux FTF-SDS-F0407 Gene Fortanely Freescale Software Engineer Catalin Udma A P R Software Engineer, Digital Networking TM External Use
2 Session Introduction This session will consist of lecture and demo about the Perf and Valgrind Memcheck tools on Linux Perf is a performance analyzing tool. It is capable of statistical profiling of an entire system (both kernel and user code), single CPU, or several threads Valgrind is a collection of tools for memory debugging, and memory leak detection. Memcheck is just one of the many tools available in Valgrind External Use 1
3 Session Objectives After completing this session you will have a basic understanding of how to obtain, install, and use the Perf and Valgrind Memcheck tools Expert understanding is beyond the scope of this session External Use 2
4 Introductions Presenter, Co-Presenter Freescale Software Engineers Engineers attending the session Name, business, current duties, experience with Perf/Valgrind Memcheck, and any learning goals for this session External Use 3
5 Agenda Introduction, Objectives, Agenda (10 minutes) Intro to Perf (10 minutes) Perf Examples (10 minutes) Intro to Valgrind Memcheck (10 minutes) Valgrind Memcheck Examples (10 minutes) Benefits of using open source tools (5 minutes) Q&A (5 minutes) External Use 4
6 Intro to Perf (1) Perf is a performance analysis tool that is based on the perf_events interface made available in Linux Kernels Version 2.6 and higher Perf is a user space utility that is part of the kernel repository. You ll need to install Perf onto your Linux system. Try apt-get install perf or equivalent. The interface between a Perf utility and the kernel consists of one syscall and is done via a file descriptor and a mmaped memory region (maps file into memory) External Use 5
7 Intro to Perf (2) Perf The Perf command on a command line interface: usage: perf [--version] [--help] COMMAND [ARGS] Perf is used with several commands: 'stat': obtain event counts. 'top': see live event count. 'record': record events for later reporting. 'report': break down events by process, function, etc. 'annotate': annotate assembly or source code with event counts. 'sched': tracing/measuring of scheduler actions and latencies. 'list': list available events. External Use 6
8 Intro to Perf (3) Freescale s QorIQ Performance Analysis tools provide a user interface that hides much of the complexity. It provides App Notes and User Manuals too. Search for PE_QORIQ_SCENT on External Use 7
9 Agenda Introduction, Objectives, Agenda (10 minutes) Intro to Perf (10 minutes) Perf Examples (10 minutes) Intro to Valgrind Memcheck (10 minutes) Valgrind Memcheck Examples (10 minutes) Benefits of using open source tools (5 minutes) Q&A (5 minutes) External Use 8
10 Perf Examples (1) Performance Evaluation #define L #define C int a[l][c]; unsigned long long f1() { unsigned long long ret = 0; int x, y; for (x = 0; x < L; x++) for (y = 0; y < C; y++) ret += a[x][y]; return ret; } #define L #define C int a[l][c]; unsigned long long f2() { unsigned long long ret = 0; int x, y; for (y = 0; y < C; y++) for (x = 0; x < L; x++) ret += a[x][y]; return ret; } The same algorithm, the same result. The same performance? Recall in C an array is arranged with the elements of the right most index located next to each other. External Use 9
11 Perf Examples (2) Performance Evaluation (continued) $ perf stat -e cache-misses./f1 Performance counter stats for './f1': 4007 cache-misses seconds time elapsed $ perf stat -e cache-misses./f2 Performance counter stats for './f2': cache-misses seconds time elapsed External Use 10
12 Perf Examples (3) Performance Evaluation (continued) What do these perf arguments mean?: $ perf stat -e cache-misses./f1 perf stat -h usage: perf stat [<options>] [<command>] -e, --event <event> event selector. use 'perf list' to list available events -i, --no-inherit child tasks do not inherit counters -p, --pid <n> stat events on existing process id -t, --tid <n> stat events on existing thread id -a, --all-cpus system-wide collection from all CPUs -c, --scale scale/normalize counters -v, --verbose be more verbose (show counter open errors, etc) -r, --repeat <n> repeat command and print average + stddev (max: 100) -n, --null null run - dont start any counters -B, --big-num print large numbers with thousands' separators External Use 11
13 Perf Examples (4) Performance Evaluation $ perf record -e cpu-clock test_perf!!!hello World!!! [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote MB perf.data $ perf report # Overhead Command Shared Object Symbol # % perf perf [.] function % perf perf [.] function1 6.67% perf [kernel.kallsyms] [k] do_page_fault External Use 12
14 Perf Examples (5) As with any open source tool, anytime you have a question you should try to solve it by experimenting with the tool, reading the documentation, searching on the Internet, and contacting other users If you are using the Freescale Processor Expert Scenarios Tool, or any other software supported by Freescale then you also have access to Freescale technical support External Use 13
15 Agenda Introduction, Objectives, Agenda (10 minutes) Intro to Perf (10 minutes) Perf Examples (10 minutes) Intro to Valgrind Memcheck (10 minutes) Valgrind Memcheck Examples (10 minutes) Benefits of using open source tools (5 minutes) Q&A (5 minutes) External Use 14
16 Intro to Valgrind Memcheck (1) Valgrind is an instrumentation framework for building dynamic analysis tools Valgrind is a collection of tools for dynamic analysis including these and more: Memcheck detects memory management problems Cachegrind a cache profiler Massif a heap profiler Helgrind thread debugger which finds data races in multithreaded programs This session will focus on Valgrind Memcheck External Use 15
17 Intro to Valgrind Memcheck (2) The Valgrind project is located at: You can install from the Freescale SDK for your silicon product. Or try apt-get install valgrind or equivalent. The Valgrind Memcheck command on a command-line interface. Memcheck is the default tool: usage: valgrind [--version] [--help] [--tool=memcheck] foo [foo s args] Memcheck can detect: Use of uninitialised memory Reading/writing memory after it has been freed Reading/writing off the end of malloc ed blocks Reading/writing inappropriate areas on the stack Memory leaks -- where pointers to malloc ed blocks are lost forever Mismatched use of malloc/new/new [] vs. free/delete/delete [] Overlapping src and dst pointers in memcpy() and related functions Some misuses of the POSIX pthreads API External Use 16
18 Agenda Introduction, Objectives, Agenda (10 minutes) Intro to Perf (10 minutes) Perf Examples (10 minutes) Intro to Valgrind Memcheck (10 minutes) Valgrind Memcheck Examples (10 minutes) Benefits of using open source tools (5 minutes) Q&A (5 minutes) External Use 17
19 Valgrind Memcheck Examples (1) First prepare your executable for use with valgrind memcheck by compiling with the g to generate debugging information: gcc g foo.c o foo Let s take a look at an example program foo.c: 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main(){ 5 6 int i; 7 int *a = malloc(sizeof(int) * 10); 8 9 if (!a) return -1; /*malloc failed*/ 10 for (i = 0; i < 11; i++){ 11 a[i] = i; 12 } free(a); 14 return 0; 15 } External Use 18
20 Valgrind Memcheck Examples (2) Running valgrind, this was my output: valgrind --tool=memcheck./a.out ==23224== Memcheck, a memory error detector ==23224== Copyright (C) , and GNU GPL'd, by Julian Seward et al. ==23224== Using Valgrind and LibVEX; rerun with -h for copyright info ==23224== Command:./a.out ==23224== ==23224== Invalid write of size 4 ==23224== at 0x : main (foo.c:11) ==23224== Address 0x41f4050 is 0 bytes after a block of size 40 alloc'd ==23224== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86- linux.so) ==23224== by 0x : main (foo.c:7) ==23224== ==23224== ==23224== HEAP SUMMARY: ==23224== in use at exit: 0 bytes in 0 blocks ==23224== total heap usage: 1 allocs, 1 frees, 40 bytes allocated ==23224== ==23224== All heap blocks were freed -- no leaks are possible ==23224== ==23224== For counts of detected and suppressed errors, rerun with: -v ==23224== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) External Use 19
21 Valgrind Memcheck Examples (3) Now the array access problem is fixed. But I have commented out the free() in foo.c: #include <stdio.h> #include <stdlib.h> int main(){ int i; int *a = malloc(sizeof(int) * 10); if (!a) return -1; /*malloc failed*/ for (i = 0; i < 10; i++){ a[i] = i; } /*free(a);*/ return 0; } External Use 20
22 Valgrind Memcheck Examples (4) Recompiling with -g and running valgrind again, this was my output: valgrind --tool=memcheck./a.out ==23394== Memcheck, a memory error detector ==23394== Copyright (C) , and GNU GPL'd, by Julian Seward et al. ==23394== Using Valgrind and LibVEX; rerun with -h for copyright info ==23394== Command:./a.out ==23394== ==23394== ==23394== HEAP SUMMARY: ==23394== in use at exit: 40 bytes in 1 blocks ==23394== total heap usage: 1 allocs, 0 frees, 40 bytes allocated ==23394== ==23394== LEAK SUMMARY: ==23394== definitely lost: 40 bytes in 1 blocks ==23394== indirectly lost: 0 bytes in 0 blocks ==23394== possibly lost: 0 bytes in 0 blocks ==23394== still reachable: 0 bytes in 0 blocks ==23394== suppressed: 0 bytes in 0 blocks ==23394== Rerun with --leak-check=full to see details of leaked memory ==23394== ==23394== For counts of detected and suppressed errors, rerun with: -v ==23394== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) External Use 21
23 Valgrind Memcheck Examples (5) Some valgrind output showing you other messages: $ valgrind --tool=memcheck --leak-check=yes./test_valgrind ==20699== Use of uninitialised value of size 4 ==20699== at 0x2B1BFB: _itoa_word (in /lib/libc-2.5.so) ==20699== by 0x2B5390: vfprintf (in /lib/libc-2.5.so) ==20699== by 0x2BCE42: printf (in /lib/libc-2.5.so) ==20699== by 0x80483F0: main (test_valgrind.c:9) ==20699== Invalid read of size 4 ==20699== at 0x : main (test_valgrind.c:12) ==20699== Address 0x401608C is 4 bytes after a block of size 40 alloc'd ==20699== at 0x40053C0: malloc (vg_replace_malloc.c:149) ==20699== by 0x80483FC: main (test_valgrind.c:11) ==20699== 4 bytes in 1 blocks are definitely lost in loss record 1 of 2 ==20699== at 0x40053C0: malloc (vg_replace_malloc.c:149) ==20699== by 0x80483D0: main (test_valgrind.c:7) External Use 22
24 Agenda Introduction, Objectives, Agenda (10 minutes) Intro to Perf (10 minutes) Perf Examples (10 minutes) Intro to Valgrind Memcheck (10 minutes) Valgrind Memcheck Examples (10 minutes) Benefits of using open source tools (5 minutes) Q&A (5 minutes) External Use 23
25 Benefits of Using Open Source Tools Open source tools are tools where the source code is published and available to view, use, modify, and redistribute. The tool is maintained by a collaborative community These are some of the benefits of using open source tools: Free of charge Source code is available to view, use, modify, and redistribute Technical development by involvement with a community of experts These are some of the costs of using open source tools: When something goes wrong, you can t call the vendor for support You have to consider licensing terms when distributing software You should contribute changes to the community External Use 24
26 Agenda Introduction, Objectives, Agenda (10 minutes) Intro to Perf (10 minutes) Perf Examples (10 minutes) Intro to Valgrind Memcheck (10 minutes) Valgrind Memcheck Examples (10 minutes) Benefits of using open source tools (5 minutes) Q&A (5 minutes) External Use 25
27 Freescale Semiconductor, Inc. External Use
CSE 160 Discussion Section. Winter 2017 Week 3
CSE 160 Discussion Section Winter 2017 Week 3 Homework 1 - Recap & a few points ComputeMandelbrotPoint func() in smdb.cpp does the job serially. You will have to do the same task in parallel manner in
More informationCSCI-1200 Data Structures Spring 2016 Lecture 6 Pointers & Dynamic Memory
Announcements CSCI-1200 Data Structures Spring 2016 Lecture 6 Pointers & Dynamic Memory There will be no lecture on Tuesday, Feb. 16. Prof. Thompson s office hours are canceled for Monday, Feb. 15. Prof.
More informationMemory Analysis tools
Memory Analysis tools PURIFY The Necessity TOOL Application behaviour: Crashes intermittently Uses too much memory Runs too slowly Isn t well tested Is about to ship You need something See what your code
More informationCSCI-1200 Data Structures Fall 2015 Lecture 6 Pointers & Dynamic Memory
CSCI-1200 Data Structures Fall 2015 Lecture 6 Pointers & Dynamic Memory Announcements: Test 1 Information Test 1 will be held Monday, September 21st, 2015 from 6-:50pm. Students have been randomly assigned
More informationDEBUGGING: DYNAMIC PROGRAM ANALYSIS
DEBUGGING: DYNAMIC PROGRAM ANALYSIS WS 2017/2018 Martina Seidl Institute for Formal Models and Verification System Invariants properties of a program must hold over the entire run: integrity of data no
More informationvalgrind overview: runtime memory checker and a bit more What can we do with it?
Valgrind overview: Runtime memory checker and a bit more... What can we do with it? MLUG Mar 30, 2013 The problem When do we start thinking of weird bug in a program? The problem When do we start thinking
More informationDebugging (Part 2) 1
Debugging (Part 2) 1 Programming in the Large Steps Design & Implement Program & programming style (done) Common data structures and algorithms Modularity Building techniques & tools (done) Test Testing
More informationPraktische Aspekte der Informatik
Praktische Aspekte der Informatik Moritz Mühlhausen Prof. Marcus Magnor Optimization valgrind, gprof, and callgrind Further Reading Warning! The following slides are meant to give you a very superficial
More informationThe Valgrind Memory Checker. (i.e., Your best friend.)
The Valgrind Memory Checker. (i.e., Your best friend.) Dept of Computing Science University of Alberta Small modifications by Stef Nychka, Mar. 2006 5th March 2006 Attribution. Introduction Some of the
More informationCSCI-1200 Data Structures Spring 2013 Lecture 7 Templated Classes & Vector Implementation
CSCI-1200 Data Structures Spring 2013 Lecture 7 Templated Classes & Vector Implementation Review from Lectures 5 & 6 Arrays and pointers Different types of memory ( automatic, static, dynamic) Dynamic
More informationIntermediate Programming, Spring 2017*
600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general
More informationCS2141 Software Development using C/C++ Debugging
CS2141 Software Development using C/C++ Debugging Debugging Tips Examine the most recent change Error likely in, or exposed by, code most recently added Developing code incrementally and testing along
More informationICHEC. Using Valgrind. Using Valgrind :: detecting memory errors. Introduction. Program Compilation TECHNICAL REPORT
ICHEC TECHNICAL REPORT Mr. Ivan Girotto ICHEC Computational Scientist Stoney Compute Node Bull Novascale R422-E2 Using Valgrind :: detecting memory errors Valgrind is a suite of command line tools both
More informationMemory Allocation in C C Programming and Software Tools. N.C. State Department of Computer Science
Memory Allocation in C C Programming and Software Tools N.C. State Department of Computer Science The Easy Way Java (JVM) automatically allocates and reclaims memory for you, e.g... Removed object is implicitly
More informationKey C Topics: Tutorial Pointers, Dynamic Memory allocation, Valgrind and Makefile CS370
Key C Topics: Tutorial Pointers, Dynamic Memory allocation, Valgrind and Makefile CS370 Outline Pointers in C & and * operators Pointers with Arrays and Strings Dynamic memory allocation malloc() and free()
More informationData and File Structures Laboratory
Tools: GDB, Valgrind Assistant Professor Machine Intelligence Unit Indian Statistical Institute, Kolkata August, 2018 1 GDB 2 Valgrind A programmer s experience Case I int x = 10, y = 25; x = x++ + y++;
More informationCSE 333 Midterm Exam Sample Solution 7/28/14
Question 1. (20 points) C programming. For this question implement a C function contains that returns 1 (true) if a given C string appears as a substring of another C string starting at a given position.
More informationCSE 374 Final Exam 3/15/17. Name UW ID#
Name UW ID# There are 10 questions worth a total of 110 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,
More informationPrinceton University Computer Science 217: Introduction to Programming Systems. Data Structures
Princeton University Computer Science 217: Introduction to Programming Systems Data Structures 1 Goals of this Lecture Help you learn (or refresh your memory) about: Common data structures: linked lists
More informationThe assignment requires solving a matrix access problem using only pointers to access the array elements, and introduces the use of struct data types.
C Programming Simple Array Processing The assignment requires solving a matrix access problem using only pointers to access the array elements, and introduces the use of struct data types. Both parts center
More informationThe Valgrind Memory Checker. (i.e., Your best friend.)
The Valgrind Memory Checker. (i.e., Your best friend.) Dept of Computing Science University of Alberta modifications by Stef Nychka October 24, 2007 Attribution. Introduction Some of the material in this
More informationProjet 0 - Correc,on. Structures de données et algorithmes
Projet 0 - Correc,on Structures de données et algorithmes Code de base #include #define uint unsigned int #define N 101 int f(int m, int M, uint* s) *s ^= (uint)(*s
More informationBoth parts center on the concept of a "mesa", and make use of the following data type:
C Programming Simple Array Processing This assignment consists of two parts. The first part focuses on array read accesses and computational logic. The second part requires solving the same problem using
More informationCSE 374 Final Exam 3/15/17 Sample Solution. Question 1. (8 points) Suppose we have the following two statements in a C program:
Question 1. (8 points) Suppose we have the following two statements in a C program: int *x = malloc(sizeof(int)); int *y = malloc(sizeof(int)); For each of the following expressions, write true if the
More informationValgrind. Philip Blakely. Laboratory for Scientific Computing, University of Cambridge. Philip Blakely (LSC) Valgrind 1 / 21
Valgrind Philip Blakely Laboratory for Scientific Computing, University of Cambridge Philip Blakely (LSC) Valgrind 1 / 21 Part I Valgrind Philip Blakely (LSC) Valgrind 2 / 21 Valgrind http://valgrind.org/
More informationScientific Programming in C IX. Debugging
Scientific Programming in C IX. Debugging Susi Lehtola 13 November 2012 Debugging Quite often you spend an hour to write a code, and then two hours debugging why it doesn t work properly. Scientific Programming
More informationScientific Programming in C IV. Pointers
Scientific Programming in C IV. Pointers Susi Lehtola 1 November 2012 Pointers The feature at the heart of C are pointers, which are simply pointers to memory addresses. Scientific Programming in C, fall
More informationC++ development tools for Linux
C++ development tools for Linux Jesper K. Pedersen Copyright 2004 Jesper K. Pedersen Table of Contents Tools in general... 1 Advanced Development Tools... 6 Tools
More informationLecture 14 Notes. Brent Edmunds
Lecture 14 Notes Brent Edmunds October 5, 2012 Table of Contents 1 Sins of Coding 3 1.1 Accessing Undeclared Variables and Pointers...................... 3 1.2 Playing With What Isn t Yours..............................
More informationPointers and Memory Management
Pointers and Memory Management Timo Karvi 2013 Timo Karvi () Pointers and Memory Management 2013 1 / 58 Memory and C I In most modern computers, main memory is divided into bytes, with each byte capable
More informationTI2725-C, C programming lab, course
Valgrind tutorial Valgrind is a tool which can find memory leaks in your programs, such as buffer overflows and bad memory management. This document will show per example how Valgrind responds to buggy
More informationEE355 Lab 5 - The Files Are *In* the Computer
1 Introduction In this lab you will modify a working word scramble game that selects a word from a predefined word bank to support a user-defined word bank that is read in from a file. This is a peer evaluated
More informationA Capacity: 10 Usage: 4 Data:
Creating a Data Type in C Integer Set For this assignment, you will use the struct mechanism in C to implement a data type that represents sets of integers. A set can be modeled using the C struct: struct
More informationHigh Performance Computing and Programming. Performance Analysis
High Performance Computing and Programming Performance Analysis What is performance? Performance is a total effectiveness of a program What are the measures of the performance? execution time FLOPS memory
More informationCptS 360 (System Programming) Unit 4: Debugging
CptS 360 (System Programming) Unit 4: Debugging Bob Lewis School of Engineering and Applied Sciences Washington State University Spring, 2018 Motivation You re probably going to spend most of your code
More informationCS 103 Lab The Files are *In* the Computer
CS 103 Lab The Files are *In* the Computer 1 Introduction In this lab you will modify a word scramble game so that instead of using a hardcoded word list, it selects a word from a file. You will learn
More informationCS168: Debugging. Introduc)on to GDB, Wireshark and Valgrind. CS168 - Debugging Helpsession
CS168: Debugging Introduc)on to GDB, Wireshark and Valgrind GDB: The GNU Debugger gdb is an executable file that serves as a portable debugger Works for Ada, C, C++, Objec)ve- C, Pascal, and others Useful
More informationComputer Systems and Networks
LECTURE 7: PERFORMANCE MEASUREMENT Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) University of the Pacific Lab Schedule Today Lab 5 Performance Measurement is open Work
More informationWhat the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope. C Flow Control.
C Flow Control David Chisnall February 1, 2011 Outline What the CPU Sees Basic Flow Control Conditional Flow Control Structured Flow Control Functions and Scope Disclaimer! These slides contain a lot of
More informationA Novel Approach to Explain the Detection of Memory Errors and Execution on Different Application Using Dr Memory.
A Novel Approach to Explain the Detection of Memory Errors and Execution on Different Application Using Dr Memory. Yashaswini J 1, Tripathi Ashish Ashok 2 1, 2 School of computer science and engineering,
More informationPerformance Measurement
ECPE 170 Jeff Shafer University of the Pacific Performance Measurement 2 Lab Schedule Activities Today / Thursday Background discussion Lab 5 Performance Measurement Next Week Lab 6 Performance Optimization
More informationAaron Evans 2004 Nov 15
Aaron Evans 2004 Nov 15 Citation Nicholas Nethercote and Julian Seward, Valgrind: A Program Supervision Framework, Electronic Notes in Theoretical Computer Science, Volume 89, Issue 2, October 2003, Pages
More informationCMSC 341 Lecture 2 Dynamic Memory and Pointers
CMSC 341 Lecture 2 Dynamic Memory and Pointers Park Sects. 01 & 02 Based on earlier course slides at UMBC Today s Topics Stack vs Heap Allocating and freeing memory new and delete Memory Leaks Valgrind
More informationMassif-Visualizer. Memory Profiling UI. Milian Wolff Desktop Summit
Massif-Visualizer Memory Profiling UI Milian Wolff mail@milianw.de Desktop Summit 2011 08.08.2011 Agenda 1 Valgrind 2 Massif 3 Massif-Visualizer Milian Massif-Visualizer Desktop Summit Berlin 2/32 1 Valgrind
More informationProgramming 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 informationDebugging and Profiling
Debugging and Profiling Dr. Axel Kohlmeyer Senior Scientific Computing Expert Information and Telecommunication Section The Abdus Salam International Centre for Theoretical Physics http://sites.google.com/site/akohlmey/
More informationClass Information ANNOUCEMENTS
Class Information ANNOUCEMENTS Third homework due TODAY at 11:59pm. Extension? First project has been posted, due Monday October 23, 11:59pm. Midterm exam: Friday, October 27, in class. Don t forget to
More informationValgrind Documentation
Valgrind Documentation Release 3.10.0 10 September 2014 Copyright 2000-2014 AUTHORS Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
More informationECE551 Midterm Version 1
Name: ECE551 Midterm Version 1 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
More informationValgrind Documentation
.eps Valgrind Documentation Release 3.13.0 15 June 2017 Copyright 2000-2017 AUTHORS Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
More informationValgrind Documentation
Valgrind Documentation Release 3.6.0 21 October 2010 Copyright 2000-2010 AUTHORS Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
More informationParallelization Primer. by Christian Bienia March 05, 2007
Parallelization Primer by Christian Bienia March 05, 2007 What is Parallelization? Answer: The creation of a new algorithm! Trivial case: Run sequential algorithm on multiple CPUs, throw locks around shared
More informationDebugging. Marcelo Ponce SciNet HPC Consortium University of Toronto. July 15, /41 Ontario HPC Summerschool 2016 Central Edition: Toronto
Debugging Marcelo Ponce SciNet HPC Consortium University of Toronto July 15, 2016 1/41 Ontario HPC Summerschool 2016 Central Edition: Toronto Outline Debugging Basics Debugging with the command line: GDB
More information6.S096: Introduction to C/C++
6.S096: Introduction to C/C++ Frank Li, Tom Lieber, Kyle Murray Lecture 4: Data Structures and Debugging! January 17, 2012 Today Memory Leaks and Valgrind Tool Structs and Unions Opaque Types Enum and
More informationPointers. Héctor Menéndez 1. November 28, AIDA Research Group Computer Science Department Universidad Autónoma de Madrid.
Pointers Héctor Menéndez 1 AIDA Research Group Computer Science Department Universidad Autónoma de Madrid November 28, 2013 1 based on the original slides of the subject Index 1 Dynamic Memory 2 Arrays
More informationRecitation: C Review. TA s 20 Feb 2017
15-213 Recitation: C Review TA s 20 Feb 2017 Agenda Logistics Attack Lab Conclusion C Assessment C Programming Style C Exercise Cache Lab Overview Appendix: Valgrind Clang / LLVM Cache Structure Logistics
More informationDevelopment in code_aster Debugging a code_aster execution
Development in code_aster Debugging a code_aster execution Code_Aster, Salome-Meca course material GNU FDL licence (http://www.gnu.org/copyleft/fdl.html) How to debug a code_aster execution? Requirements
More informationPointer Accesses to Memory and Bitwise Manipulation
C Programming Pointer Accesses to Memory and Bitwise Manipulation This assignment consists of implementing a function that can be executed in two modes, controlled by a switch specified by a parameter
More informationGo Multicore Series:
Go Multicore Series: Understanding Memory in a Multicore World, Part 2: Software Tools for Improving Cache Perf Joe Hummel, PhD http://www.joehummel.net/freescale.html FTF 2014: FTF-SDS-F0099 TM External
More informationProfilers and Debuggers. Introductory Material. One-Slide Summary
Profilers and Debuggers #1 Introductory Material First, who doesn t know assembly language? You ll get to answer all the assembly questions. Yes, really. Lecture Style: Sit on the table and pose questions.
More informationAgenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2
Lecture 3: Processes Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Process in General 3.3 Process Concept Process is an active program in execution; process
More informationKDev-Valgrind : User Documentation
KDev-Valgrind : User Documentation Damien Coppel Anthony Corbacho Lionel Duc Mathieu Lornac Sébastien Rannou Lucas Sarie This document is for developers wishing to use the plugin. It enables to understand
More informationCS 3305 Intro to Threads. Lecture 6
CS 3305 Intro to Threads Lecture 6 Introduction Multiple applications run concurrently! This means that there are multiple processes running on a computer Introduction Applications often need to perform
More informationMemory Management. CS449 Fall 2017
Memory Management CS449 Fall 2017 Life9mes Life9me: 9me from which a par9cular memory loca9on is allocated un9l it is deallocated Three types of life9mes Automa9c (within a scope) Sta9c (dura9on of program)
More informationCache Profiling with Callgrind
Center for Information Services and High Performance Computing (ZIH) Cache Profiling with Callgrind Linux/x86 Performance Practical, 17.06.2009 Zellescher Weg 12 Willers-Bau A106 Tel. +49 351-463 - 31945
More informationCSCI-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 informationCS 31: Intro to Systems Pointers and Memory. Kevin Webb Swarthmore College October 2, 2018
CS 31: Intro to Systems Pointers and Memory Kevin Webb Swarthmore College October 2, 2018 Overview How to reference the location of a variable in memory Where variables are placed in memory How to make
More informationIntroduction to pthreads
CS 220: Introduction to Parallel Computing Introduction to pthreads Lecture 25 Threads In computing, a thread is the smallest schedulable unit of execution Your operating system has a scheduler that decides
More informationjust a ((somewhat) safer) dialect.
Intro_to_C Page 1 Intro to C Tuesday, September 07, 2004 5:30 PM C was developed specifically for writing operating systems Low level of abstraction. "Just above machine language." Direct access to the
More information12. Debugging. Overview. COMP1917: Computing 1. Developing Programs. The Programming Cycle. Programming cycle. Do-it-yourself debugging
COMP1917 12s2 Debugging 1 COMP1917: Computing 1 12. Debugging Overview Programming cycle Do-it-yourself debugging Debugging withgdb Nastier bugs Memory leaks COMP1917 12s2 Debugging 2 Developing Programs
More informationpthreads 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 informationECE551 Midterm Version 2
Name: ECE551 Midterm Version 2 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
More informationunsigned char memory[] STACK ¼ 0x xC of address space globals function KERNEL code local variables
Graded assignment 0 will be handed out in section Assignment 1 Not that bad Check your work (run it through the compiler) Factorial Program Prints out ENTERING, LEAVING, and other pointers unsigned char
More informationValgrind Documentation Release June 2006 Copyright AUTHORS
Valgrind Documentation Release 3.2.0 7 June 2006 Copyright 2000-2006 AUTHORS Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
More informationCS61, Fall 2012 Section 2 Notes
CS61, Fall 2012 Section 2 Notes (Week of 9/24-9/28) 0. Get source code for section [optional] 1: Variable Duration 2: Memory Errors Common Errors with memory and pointers Valgrind + GDB Common Memory Errors
More informationCSci 4061 Introduction to Operating Systems. Programs in C/Unix
CSci 4061 Introduction to Operating Systems Programs in C/Unix Today Basic C programming Follow on to recitation Structure of a C program A C program consists of a collection of C functions, structs, arrays,
More informationCS C Primer. Tyler Szepesi. January 16, 2013
January 16, 2013 Topics 1 Why C? 2 Data Types 3 Memory 4 Files 5 Endianness 6 Resources Why C? C is exteremely flexible and gives control to the programmer Allows users to break rigid rules, which are
More informationProcesses. Johan Montelius KTH
Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other
More informationA process. the stack
A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes
More informationConcurrent Programming
Concurrent Programming CS 485G-006: Systems Programming Lectures 32 33: 18 20 Apr 2016 1 Concurrent Programming is Hard! The human mind tends to be sequential The notion of time is often misleading Thinking
More informationComputer Systems Laboratory Sungkyunkwan University
Concurrent Programming Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Echo Server Revisited int main (int argc, char *argv[]) {... listenfd = socket(af_inet, SOCK_STREAM, 0); bzero((char
More informationOS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed
Process Management CS 537 Lecture 3: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units
More informationwww nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed
Process Management CS 537 Lecture 4: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units
More informationLecture 07 Debugging Programs with GDB
Lecture 07 Debugging Programs with GDB In this lecture What is debugging Most Common Type of errors Process of debugging Examples Further readings Exercises What is Debugging Debugging is the process of
More informationSingle Processor Optimization III
Russian-German School on High-Performance Computer Systems, 27th June - 6th July, Novosibirsk 2. Day, 28th of June, 2005 HLRS, University of Stuttgart Slide 1 Outline Motivation Valgrind Memory Tracing
More informationNew features in AddressSanitizer. LLVM developer meeting Nov 7, 2013 Alexey Samsonov, Kostya Serebryany
New features in AddressSanitizer LLVM developer meeting Nov 7, 2013 Alexey Samsonov, Kostya Serebryany Agenda AddressSanitizer (ASan): a quick reminder New features: Initialization-order-fiasco Stack-use-after-scope
More informationCS 31: Intro to Systems Pointers and Memory. Martin Gagne Swarthmore College February 16, 2016
CS 31: Intro to Systems Pointers and Memory Martin Gagne Swarthmore College February 16, 2016 So we declared a pointer How do we make it point to something? 1. Assign it the address of an existing variable
More informationECE 571 Advanced Microprocessor-Based Design Lecture 2
ECE 571 Advanced Microprocessor-Based Design Lecture 2 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 21 January 2016 Announcements HW#1 will be posted tomorrow I am handing out
More informationTuning Valgrind for your Workload
Tuning Valgrind for your Workload Hints, tricks and tips to effectively use Valgrind on small or big applications Philippe Waroquiers FOSDEM 2015 valgrind devroom 1 Some rumours about Valgrind... Valgrind
More informationOperating Systems CMPSC 473. Process Management January 29, Lecture 4 Instructor: Trent Jaeger
Operating Systems CMPSC 473 Process Management January 29, 2008 - Lecture 4 Instructor: Trent Jaeger Last class: Operating system structure and basics Today: Process Management Why Processes? We have programs,
More informationAn example Request R1 for 100 bytes Request R2 for 1 byte Memory from R1 is freed Request R3 for 50 bytes What if R3 was a request for 101 bytes?
Agenda CS 61C: Great Ideas in Computer Architecture: Malloc Examples, Introduction to Machine Language Instructor: Michael Greenbaum http://inst.eecs.berkeley.edu/~cs61c/su11 Malloc Review and Examples
More informationProgramming Tips for CS758/858
Programming Tips for CS758/858 January 28, 2016 1 Introduction The programming assignments for CS758/858 will all be done in C. If you are not very familiar with the C programming language we recommend
More informationMemory Management. a C view. Dr Alun Moon KF5010. Computer Science. Dr Alun Moon (Computer Science) Memory Management KF / 24
Memory Management a C view Dr Alun Moon Computer Science KF5010 Dr Alun Moon (Computer Science) Memory Management KF5010 1 / 24 The Von Neumann model Memory Architecture One continuous address space Program
More informationComputer Systems and Networks
University of the Pacific LECTURE 7: PERFORMANCE MEASUREMENT 13 TH FEB, 2018 Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) Lab Schedule Today Lab 5 Performance Measurement
More informationDr. Memory MEMORY DEBUGGER FOR WINDOWS AND LINUX WGM #47 GUSTAVO ROVELO MARCH 1 ST, 2012
Dr. Memory MEMORY DEBUGGER FOR WINDOWS AND LINUX WGM #47 GUSTAVO ROVELO MARCH 1 ST, 2012 What are we talking about today? Tools for Performing Application Analysis What is Dr. Memory? 2 Image: http://somewhatcontent.blogspot.com/2010/08/things-i-didnt-have-to-do-today.html
More informationCS510 Operating System Foundations. Jonathan Walpole
CS510 Operating System Foundations Jonathan Walpole Threads & Concurrency 2 Why Use Threads? Utilize multiple CPU s concurrently Low cost communication via shared memory Overlap computation and blocking
More informationApril 4-7, 2016 Silicon Valley. CUDA DEBUGGING TOOLS IN CUDA8 Vyas Venkataraman, Kudbudeen Jalaludeen, April 6, 2016
April 4-7, 2016 Silicon Valley CUDA DEBUGGING TOOLS IN CUDA8 Vyas Venkataraman, Kudbudeen Jalaludeen, April 6, 2016 AGENDA General debugging approaches Cuda-gdb Demo 2 CUDA API CHECKING CUDA calls are
More informationSystem Assertions. Andreas Zeller
System Assertions Andreas Zeller System Invariants Some properties of a program must hold over the entire run: must not access data of other processes must handle mathematical exceptions must not exceed
More informationMemory Checking and Single Processor Optimization with Valgrind [05b]
Memory Checking and Single Processor Optimization with Valgrind Memory Checking and Single Processor Optimization with Valgrind [05b] University of Stuttgart High-Performance Computing-Center Stuttgart
More informationCSEN 602-Operating Systems, Spring 2018 Practice Assignment 2 Solutions Discussion:
CSEN 602-Operating Systems, Spring 2018 Practice Assignment 2 Solutions Discussion: 10.2.2018-15.2.2018 Exercise 2-1: Reading Read sections 2.1 (except 2.1.7), 2.2.1 till 2.2.5. 1 Exercise 2-2 In Fig.1,
More information