Domain-Specific Profiling - TOOLS 2011
-
Upload
jorge-ressia -
Category
Technology
-
view
1.395 -
download
0
Transcript of Domain-Specific Profiling - TOOLS 2011
Domain-Specific
Profiling
Alexandre Bergel, Oscar Nierstrasz, Lukas Renggli and Jorge Ressia
Profiling:Is the activity of analyzing a program execution.
Traditional Profilers
Source Report
Profile
Examples
CPU time
Mondrian
System Complexity
Lanza and Ducasse 2003
D omain-Sp ecific P rofiling 3
C P U t i m e p rofi li ng
Mondrian [9] is an open and agile visualiza t ion engine. Mondrian describes avisualiza t ion using a graph of (possibly nested) nodes and edges. In June 2010a serious performance issue was raised1 . Tracking down t he cause of t he poorperformance was not t rivial. We first used a st andard sample-based profiler.
E xecu t ion sampling approxima tes t he t ime spent in an applica t ion’s met hodsby periodically stopping a program and recording t he current set of met hodsunder execu t ions. Such a profiling technique is rela t ively accurate since i t hasli t t le impact on t he overall execu t ion. T his sampling technique is used by almostall mainst ream profilers, such as J P rofiler, Your K i t , xprof [10], and hprof.
M essage Tally, t he st andard sampling-based profiler in P haro Small t alk2 , tex-t ually describes t he execu t ion in terms of C P U consump t ion and invocat ion foreach met hod of Mondrian:
54.8% {11501ms} MOCanvas> >drawOn:54.8% {11501ms} MORoot(MONode) > >displayOn:30.9% {6485ms} MONode > >displayOn:
| 18.1% {3799ms} MOEdge > >displayOn:...
| 8.4% {1763ms} MOEdge> >displayOn:| | 8.0% {1679ms} MOStraightLineShape > >display:on:| | 2.6% {546ms} FormCanvas> > line:to:width:color:...
23.4% {4911ms} MOEdge > >displayOn:...
We can observe t hat t he vir t ual machine spent abou t 54% of i ts t ime int he met hod displayOn: defined in t he class MORoot. A root is t he unique non-nested node t hat cont ains all t he nodes of t he edges of t he visualizat ion. T hisgeneral profiling informat ion says t hat rendering nodes and edges consumes agrea t share of t he C P U t ime, bu t i t does not help in pinpoint ing which nodesand edges are responsible for t he t ime spent . Not all graphical elements equallyconsume resources.
Tradi t ional execu t ion sampling profilers center t heir resul t on t he frames oft he execu t ion st ack and completely ignore t he ident i ty of t he ob ject t hat receivedt he met hod call and i ts arguments. A s a consequence, i t is hard to t rack downwhich ob jects cause t he slowdown. For t he example above, t he t radi t ional profilersays t ha t we spent 30.9% in MONode > >displayOn: wi t hou t saying which nodeswere act ually refreshed too often.
C over age
Pet i t Parser is a parsing framework combining ideas from scannerless parsing,parser combinators, parsing expression grammars and packrat parsers to modelgrammars and parsers as ob jects t hat can be reconfigured dynamically [11].1 h t t p : / / f o r um . wo r l d . s t / Mond r i an - i s - s l ow - nex t - s t ep - t c2257050 . h t m l #
a22611162 h t t p : / / www . pha r o - p r o j ec t . o r g /
Which is the relationship?
D omain-Sp ecific P rofiling 3
C P U t i m e p rofi li ng
Mondrian [9] is an open and agile visualiza t ion engine. Mondrian describes avisualiza t ion using a graph of (possibly nested) nodes and edges. In June 2010a serious performance issue was raised1 . Tracking down t he cause of t he poorperformance was not t rivial. We first used a st andard sample-based profiler.
E xecu t ion sampling approximates t he t ime spent in an applica t ion’s met hodsby periodically stopping a program and recording t he current set of met hodsunder execu t ions. Such a profiling technique is rela t ively accurate since i t hasli t t le impact on t he overall execu t ion. T his sampling technique is used by almostall mainst ream profilers, such as J P rofiler, Your K i t , xprof [10], and hprof.
M essage Tally, t he st andard sampling-based profiler in P haro Small t alk2 , tex-t ually describes t he execu t ion in terms of C P U consump t ion and invocat ion foreach met hod of Mondrian:
54.8% {11501ms} MOCanvas> >drawOn:54.8% {11501ms} MORoot(MONode) > >displayOn:30.9% {6485ms} MONode > >displayOn:
| 18.1% {3799ms} MOEdge > >displayOn:...
| 8.4% {1763ms} MOEdge> >displayOn:| | 8.0% {1679ms} MOStraightLineShape > >display:on:| | 2.6% {546ms} FormCanvas> > line:to:width:color:...
23.4% {4911ms} MOEdge > >displayOn:...
We can observe t hat t he vir t ual machine spent abou t 54% of i ts t ime int he met hod displayOn: defined in t he class MORoot. A root is t he unique non-nested node t hat cont ains all t he nodes of t he edges of t he visualizat ion. T hisgeneral profiling informa t ion says t ha t rendering nodes and edges consumes agrea t share of t he C P U t ime, bu t i t does not help in pinpoint ing which nodesand edges are responsible for t he t ime spent . Not all graphical elements equallyconsume resources.
Tradi t ional execu t ion sampling profilers center t heir resul t on t he frames oft he execu t ion st ack and completely ignore t he ident i ty of t he ob ject t ha t receivedt he met hod call and i ts arguments. A s a consequence, i t is hard to t rack downwhich ob jects cause t he slowdown. For t he example above, t he t radi t ional profilersays t ha t we spent 30.9% in MONode > >displayOn: wi t hou t saying which nodeswere act ually refreshed too often.
C over age
Pet i t Parser is a parsing framework combining ideas from scannerless parsing,parser combinators, parsing expression grammars and packrat parsers to modelgrammars and parsers as ob jects t ha t can be reconfigured dynamically [11].1 h t t p : / / f o r um . wo r l d . s t / Mond r i an - i s - s l ow - nex t - s t ep - t c2257050 . h t m l #
a22611162 h t t p : / / www . pha r o - p r o j ec t . o r g /
?
Coverage
scg.unibe.ch/research/helvetia/petitparser
210 Methods
Java Grammar
100% coverage to build grammar
210 Methods
Java Grammar
100% coverage to build grammar
Is each production of the grammar covered?
Source Report
Domain
Profile
SourceCode
Domain
TraditionalProfilers
SourceCode
Domain
TraditionalProfilers
Domain-SpecificProfilers
What does it
mean?
Specify
Capture
Present
MetaSpy
ProfilerInstrumenter
DomainObject
DomainObject
DomainObject
Domain
��������
�������
DomainObject
DomainObject
DomainObject
Domain
��������
�������
DomainObject
DomainObject
DomainObject
Domain
��������
�������
MetaInstrumenter
installsetUptearDownuninstall
handler
installuninstall
announcer
AnnouncementInstrumenter
doesNotUnderstand:run:with:in:installsetUptearDownuninstall
theClassselectormethdo
MethodInstrumenter
installuninstall
parsergrammarreplacement
ParserInstrumenter
Profiler
observeClass:do:observeClass:selector:doobservePackage:do:observePackagesMatching:do:observeParser:in:do:installsetUptearDownuninstall
modelstrategies
setUpvisualize
MondrianProfilersetUpvisualize
OmniBrowserProfilersetUpvisualize
PetitParserProfiler
Instrumentation strategies Profilers
User provided classes
Specify the Domain interests
Capture the runtime
information
Present the results
Mondrian Profiler
System Complexity
Lanza, Ducasse 2003
MondrianProfiler>>setUp self model root allNodes do: [ :node | self observeObject: node selector: #displayOn: do: [ ... counting ... ] ]
Profiler
PetitParserProfiler>>setUp self model allParsers
do: [ :parser | self
observeParser: parser in: self grammar do: [ ... counting ... ] ]
Implementation
Instrumentation
Two options
Hooking to the Domain
Reflection
Reflection
scg.unibe.ch/research/bifrost
Organize the Meta-level
ExplicitMeta-objects
Object
InstrumentationMeta-object
Class
Object
InstrumentationMeta-object
Class
Instrumented Object
InstrumentationMeta-object
Class
Partial ReflectionSelective Reifications
UnanticipatedRuntime Integration
Adaptation Composition
Source
Profile
Source
Profile
Domain-specific
Information
MetaSpy
SourceCode
Domain
TraditionalProfilers
Domain-SpecificProfilers