Brandenburgische Technische Universität Cottbus Program Profiling Andrzej Filipiak Übung Testen...

Post on 05-Apr-2015

103 views 0 download

Transcript of Brandenburgische Technische Universität Cottbus Program Profiling Andrzej Filipiak Übung Testen...

Brandenburgische Technische Universität Cottbus

„Program Profiling“

Andrzej Filipiak

Übung Testen von Software

andrzej@zielona-gora.home.pl

SoSe 2006

Gliederung

Einleitung

gprof GNU Profiler

Eclipse Test & Performance Tools Platform

Zusammenfassung

Literatur / Quellen

Übung Testen von Software

2

Einleitung – Profiling

Zeit-, Funktionen- und Objektstatistiken

Optimierungshinweise „20/80-Regel“

Fehlererkennung – zu viel / zu wenig Zeit

Übung Testen von Software

3

gprof GNU Profiler

gprof (1) Inhaltsübersicht

Informationen

Installation

Optionen

Ausführung

Beispiel

Beurteilung

Übung Testen von Software

5

gprof (2) Informationen, Installation C / C++ (Linux)

In Fast jeder Linux-Distribution (binutils)

GPL (General Public License)

Knoppix 4.0.2, binutils-Version 2.16.1

SuSe 9.0, binutils-Version 2.15.90

Übung Testen von Software

6

gprof (3) Optionen

Compiler -pg ( p „flaches Profil“, g Funktionengraph) -g (Debugger-Informationen)

gprof -l (Informationen zu jeder Zeile) -A (Informationen zu jeder Funktion) -z (Informationen über nicht ausgeführte

Funktionen)

Übung Testen von Software

7

gprof (4) Ausführen

Kompilierung mit Parameter g++ -pg test.cpp –o test

Programmausführung ./test

gmon.out Datei wurde erstellt Ablauf des Programms überlegen Kein Fehler darf auftreten

Profilerausführung gprof test > ergebnisse.txt

Übung Testen von Software

8

gprof (5) Beispiel

const int N = 40000;

int vector[N];

void copy(void){

for (int i = N - 1; i > 0; i--)

vector[i] = vector[i-1];

}

void insert(int n){

copy();

vector[0] = n;

}

int main(int argc, char **argv){

for (int i = 0; i < N; i++)

insert(i);

return 0; }Übung Testen von Software

9

gprof (6) Beurteilung

Vorteile In fast jeder Linux-Distribution Kostenlos Mehrere Optionen Funktioniert unter Knoppix (?) Wird ständig erweitert / verbessert

Übung Testen von Software

10

gprof (7) Beurteilung

Nachteile Kommandozeile (Command Line)

Viele Optionen / Argumente Mehrere Ausführungsschritte

Ergebnisse nur im Textmodus Hoher Analysierungsaufwand

Übung Testen von Software

11

Eclipse Test & Performance Tools Platform (TPTP)

TPTP (1) Inhaltsübersicht

Informationen

Installation

Beispiel

Beurteilung

Übung Testen von Software

13

TPTP (2) Informationen

Eclipse Test & Performance Tools Platform (TPTP) Platform

User Interface Standard Daten-Modelle Sammeln von Daten Kommunikation Remote Execution Environments Extension-Points

Monitoring Tools Testing Tools Tracing and Profiling Tools

Übung Testen von Software

14

TPTP (3) Informationen

Zielsprache(n) Java ( C/C++ geplant )

Zielsysteme Windows, Linux, Unix, Solaris

Lizenzstatus Open Source-Projekt

Übung Testen von Software

15

TPTP (4) Informationen (2)

TPTP-Voraussetzungen (Release 4.1.0.1)

Eclipse SDK 3.1.2

Java Runtime (JRE) oder Java Development Kit (JDK) 1.4

Eclipse Modeling Framework (EMF) SDK 2.1.2

XML Schema Infoset Model (XSD) SDK 2.1.2

Agent Controller

Übung Testen von Software

16

TPTP (5) Installation

Eclipse Download unter http://www.eclipse.org/ zip-Datei SDK v. 3.1.2

Test & Performance Tools Platform Download unter http://www.eclipse.org/tptp/ Release 4.1.0.1

Eclipse Modeling Framework Tipps unter http://www.eclipse.org/tptp/

XML Schema Infoset Model & Agent Controller Tipps unter http://www.eclipse.org/tptp/

Übung Testen von Software

17

TPTP (6) Beispiel

http://www.eclipse.org/articles/Article-TPTP-Profiling-tool/tptpProfilingArticle.html

http://www.eclipse.org/tptp/home/documents/tutorials/screencasts/tptpProfile.html

Übung Testen von Software

18

TPTP (7) Beurteilung

Vorteile Viele Optionen / Testmöglichkeiten Grafische Darstellung von Ergebnissen Für mehrere Betriebssysteme geeignet Kostenlos

Übung Testen von Software

19

TPTP (8) Beurteilung (2)

Nachteile Nichttriviale Bedienung Komplexe Installation

Übung Testen von Software

20

Profiling – Zusammenfassung

Hilfreich bei (großen) Projekten Analyse Optimierung Erkennung von Fehlern

Keine extra Softwarekosten

Übung Testen von Software

21

Literatur / Quellen

gprof http://sources.redhat.com/binutils/docs-2.16/gprof/index.html http://www.gnu.org/software/binutils/manual/gprof-2.9.1/

gprof.html http://mops.uci.agh.edu.pl/~mylka/gprof/index.html

TPTP http://www.eclipse.org/tptp/index.html http://www.eclipse.org/tptp/home/documents/index.html http://www.eclipse.org/articles/Article-TPTP-Profiling-Tool/

tptpProfilingArticle.html http://www.eclipse.org/tptp/home/documents/tutorials/

screencasts/tptpProfile.html

Übung Testen von Software

22

Danke für IhreAufmerksamkeit!