SlideShare une entreprise Scribd logo
1  sur  16
DTrace, for Solaris (zones
inside) and Java

 Amit Hurvitz, ISV Engineering, Oracle
Program Agenda

 Introductory Demo
 What's Dtrace?
 Enabling Dtrace from Inside the Zone
 Java Statically Defined Tracing
 TCP Client and Server Flow Tracing - Demo
 Future Thoughts
Int roduc t ory D o
em
What's DTrace? - cont.

 Zero performance impact when not in use
 Completely safe; no way to cause panics, crashes, data corruption or

pathological performance degradation
 Powerful data management primitives eliminate need for most postprocessing
DTrace – D Language
probe description
/predicate/
{
actions
}
Probes Which events we are interested in monitoring
 Predicates (optional) When do we want to monitor the events
 Actions (optional) What do we want to do when the above
happens


 One liner


# dtrace -n 'probe/predicate/{actions}'
{actions}
DTrace – Probes
 Programmable sensors (points of instrumentation) made available by

providers placed all over the Solaris system

provider:module:function:name
−

tcp:ip:tcp_send:entry

−

Syscall:::

 Providers: syscall,io,pid,profile, hotspot, tcp, udp, ip, iscsi,...
 Modules: nfs, zfs, cpc, …
 Names: entry,return
 Listing Probes


# dtrace -l [-P provider | -m module | -f function name | -n name]
DTrace – Predicates and Actions
 Predicates


/cpu == 0/



/execname == “date”/



/ppid != 0 && arg0 != 0/

 Actions


Commands separated by “;”



trace(execname)



printf(“%s %s %s”, execname, probefunc, copyinstr(arg0));

 Predefined Variables


execname, probefunc, pid, ppid, cpu, timestamp,
arg0, arg1, ...
DTrace – Aggregations
 Used to aggregate data and look for trends
 Has the general form:


@name[keys] = aggfunc(args)

 Aggregating functions


count(), sum(), avg(), min(), max(), quantize(), lquantize()

 Examples:


% dtrace -n 'syscall::read*:entry{@[execname]=count();}'



% dtrace -n 'syscall::read*:entry{@[execname,arg0]=count();}'
An Example – Off-CPU Tracing
#!/usr/sbin/dtrace -s
BEGIN
{
start_timestamp = timestamp;
}
sched:::off-cpu
/pid == $1/
{
self->ts = timestamp;
}
sched:::on-cpu
/self->ts/
{
@[stack(), jstack(), "ns"] = sum(timestamp - self->ts); self->ts = 0;
}
END
{
printf("elapsed time: %dn", timestamp - start_timestamp);
}
Enabling DTrace in a Zone
Java Statically Defined Tracing (JSDT)
 Make points of interest in your application easily monitored
 Insert your own DTrace probes in desired locations inside your

methods
– Use them in conjunction with any other probes
#!/usr/sbin/dtrace -s
MyProvider:::start
{
self->start_time = timestamp;
}
syscall:::entry
/self->start_time/
{
@[probefunc] = quantize();
}
JSDT – define a Provider
public interface MyProvider extends com.sun.tracing.Provider
{
Provider Interface
void methodEntry();
void methodReturn();
void start();
void dataAdded(int x, int y);
void myProbe(int intData, String stringData);
}
JSDT – insert probes to your Java code
import com.sun.tracing.*;
Provider Interface
MyProvider provider;
public static void main(String args) {
ProviderFactory factory = ProviderFactory.getDefaultFactory();
provider = factory.createProvider(MyProvider.class);
}
public void method() {
provider.methodEntry();
...
provider.myProbe(i, str);
...
provider.methodReturn();
}

Call probes actions

Create the
provider
Fl ow Trac e- D o
em
Next Thoughts
 A special ‘Java-DTrace’ utility to do implicit instrumentation


Probes look like native DTrace PID provider:
−
−





JDDT$target:class-name:method-name:entry
JDDT$target:class-name:method-name:return

# jdtrace java-dtrace-script.d -p <process-id>
jdtrace will take care of all required dynamic instrumentation
−



Clean instrumented code on script end

Any suggestions?
Thanks!
Amit.Hurvitz@oracle.com

Contenu connexe

Tendances

Tendances (11)

TensorFlow example for AI Ukraine2016
TensorFlow example  for AI Ukraine2016TensorFlow example  for AI Ukraine2016
TensorFlow example for AI Ukraine2016
 
Ember
EmberEmber
Ember
 
Rajat Monga at AI Frontiers: Deep Learning with TensorFlow
Rajat Monga at AI Frontiers: Deep Learning with TensorFlowRajat Monga at AI Frontiers: Deep Learning with TensorFlow
Rajat Monga at AI Frontiers: Deep Learning with TensorFlow
 
Machine Learning Model Bakeoff
Machine Learning Model BakeoffMachine Learning Model Bakeoff
Machine Learning Model Bakeoff
 
Learning stochastic neural networks with Chainer
Learning stochastic neural networks with ChainerLearning stochastic neural networks with Chainer
Learning stochastic neural networks with Chainer
 
Tensorflow - Intro (2017)
Tensorflow - Intro (2017)Tensorflow - Intro (2017)
Tensorflow - Intro (2017)
 
Introduction to TensorFlow
Introduction to TensorFlowIntroduction to TensorFlow
Introduction to TensorFlow
 
Introduction to Machine Learning with TensorFlow
Introduction to Machine Learning with TensorFlowIntroduction to Machine Learning with TensorFlow
Introduction to Machine Learning with TensorFlow
 
Parallel Computing with R
Parallel Computing with RParallel Computing with R
Parallel Computing with R
 
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John MelonakosPT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
PT-4054, "OpenCL™ Accelerated Compute Libraries" by John Melonakos
 
Joel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMDJoel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMD
 

En vedette

Os Leventhal
Os LeventhalOs Leventhal
Os Leventhal
oscon2007
 
DTrace - Miracle Scotland Database Forum
DTrace - Miracle Scotland Database ForumDTrace - Miracle Scotland Database Forum
DTrace - Miracle Scotland Database Forum
Doug Burns
 
DTrace talk at Oracle Open World
DTrace talk at Oracle Open WorldDTrace talk at Oracle Open World
DTrace talk at Oracle Open World
Angelo Rajadurai
 

En vedette (20)

Oraclew2013 devopsjlm
Oraclew2013 devopsjlmOraclew2013 devopsjlm
Oraclew2013 devopsjlm
 
Advanced resource management and scalability features for cloud environment u...
Advanced resource management and scalability features for cloud environment u...Advanced resource management and scalability features for cloud environment u...
Advanced resource management and scalability features for cloud environment u...
 
Oracle Solaris 11 Built for Clouds
Oracle Solaris 11 Built for Clouds Oracle Solaris 11 Built for Clouds
Oracle Solaris 11 Built for Clouds
 
Walla migration
Walla  migrationWalla  migration
Walla migration
 
Oracle Solaris 11 as a BIG Data Platform Apache Hadoop Use Case
Oracle Solaris 11 as a BIG Data Platform Apache Hadoop Use CaseOracle Solaris 11 as a BIG Data Platform Apache Hadoop Use Case
Oracle Solaris 11 as a BIG Data Platform Apache Hadoop Use Case
 
Solaris vs Linux
Solaris vs LinuxSolaris vs Linux
Solaris vs Linux
 
Os Leventhal
Os LeventhalOs Leventhal
Os Leventhal
 
DTrace
DTraceDTrace
DTrace
 
Adopt-a-JSR for JSON Processing 1.1, JSR 374
Adopt-a-JSR for JSON Processing 1.1, JSR 374Adopt-a-JSR for JSON Processing 1.1, JSR 374
Adopt-a-JSR for JSON Processing 1.1, JSR 374
 
DTrace - Miracle Scotland Database Forum
DTrace - Miracle Scotland Database ForumDTrace - Miracle Scotland Database Forum
DTrace - Miracle Scotland Database Forum
 
DTrace talk at Oracle Open World
DTrace talk at Oracle Open WorldDTrace talk at Oracle Open World
DTrace talk at Oracle Open World
 
GlassFish Story by David Heffelfinger/Ensode Technology
GlassFish Story by David Heffelfinger/Ensode TechnologyGlassFish Story by David Heffelfinger/Ensode Technology
GlassFish Story by David Heffelfinger/Ensode Technology
 
LodgON at GlassFish Community Event, JavaOne 2011
LodgON at GlassFish Community Event, JavaOne 2011LodgON at GlassFish Community Event, JavaOne 2011
LodgON at GlassFish Community Event, JavaOne 2011
 
Guia de Semana at GlassFish Community Event, JavaOne 2011
Guia de Semana at GlassFish Community Event, JavaOne 2011Guia de Semana at GlassFish Community Event, JavaOne 2011
Guia de Semana at GlassFish Community Event, JavaOne 2011
 
Parleys.com at GlassFish Community Event, JavaOne 2011
Parleys.com at GlassFish Community Event, JavaOne 2011Parleys.com at GlassFish Community Event, JavaOne 2011
Parleys.com at GlassFish Community Event, JavaOne 2011
 
Adam Bien at GlassFish Community Event, JavaOne 2011
Adam Bien at GlassFish Community Event, JavaOne 2011Adam Bien at GlassFish Community Event, JavaOne 2011
Adam Bien at GlassFish Community Event, JavaOne 2011
 
Java EE 6 Adoption in One of the World’s Largest Online Financial Systems
Java EE 6 Adoption in One of the World’s Largest Online Financial SystemsJava EE 6 Adoption in One of the World’s Largest Online Financial Systems
Java EE 6 Adoption in One of the World’s Largest Online Financial Systems
 
GlassFish Story by Kerry Wilson/Vanderbilt University Medical Center
GlassFish Story by Kerry Wilson/Vanderbilt University Medical CenterGlassFish Story by Kerry Wilson/Vanderbilt University Medical Center
GlassFish Story by Kerry Wilson/Vanderbilt University Medical Center
 
OpenSolaris 2009.06 Workshop
OpenSolaris 2009.06 WorkshopOpenSolaris 2009.06 Workshop
OpenSolaris 2009.06 Workshop
 
Jenzabar at GlassFish Community Event, JavaOne 2011
Jenzabar at GlassFish Community Event, JavaOne 2011Jenzabar at GlassFish Community Event, JavaOne 2011
Jenzabar at GlassFish Community Event, JavaOne 2011
 

Similaire à Cloud Observation and Performance Analysis using Solaris 11 DTrace

It802 bruning
It802 bruningIt802 bruning
It802 bruning
mrbruning
 
D Trace Support In My Sql Guide To Solving Reallife Performance Problems
D Trace Support In My Sql Guide To Solving Reallife Performance ProblemsD Trace Support In My Sql Guide To Solving Reallife Performance Problems
D Trace Support In My Sql Guide To Solving Reallife Performance Problems
MySQLConference
 
Building Deep Reinforcement Learning Applications on Apache Spark with Analyt...
Building Deep Reinforcement Learning Applications on Apache Spark with Analyt...Building Deep Reinforcement Learning Applications on Apache Spark with Analyt...
Building Deep Reinforcement Learning Applications on Apache Spark with Analyt...
Databricks
 

Similaire à Cloud Observation and Performance Analysis using Solaris 11 DTrace (20)

CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
A22 Introduction to DTrace by Kyle Hailey
A22 Introduction to DTrace by Kyle HaileyA22 Introduction to DTrace by Kyle Hailey
A22 Introduction to DTrace by Kyle Hailey
 
Dynamic Tracing of your AMP web site
Dynamic Tracing of your AMP web siteDynamic Tracing of your AMP web site
Dynamic Tracing of your AMP web site
 
It802 bruning
It802 bruningIt802 bruning
It802 bruning
 
Learning Dtrace
Learning DtraceLearning Dtrace
Learning Dtrace
 
dtrace
dtracedtrace
dtrace
 
Debug generic process
Debug generic processDebug generic process
Debug generic process
 
No more struggles with Apache Spark workloads in production
No more struggles with Apache Spark workloads in productionNo more struggles with Apache Spark workloads in production
No more struggles with Apache Spark workloads in production
 
D Trace Support In My Sql Guide To Solving Reallife Performance Problems
D Trace Support In My Sql Guide To Solving Reallife Performance ProblemsD Trace Support In My Sql Guide To Solving Reallife Performance Problems
D Trace Support In My Sql Guide To Solving Reallife Performance Problems
 
TensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache SparkTensorFrames: Google Tensorflow on Apache Spark
TensorFrames: Google Tensorflow on Apache Spark
 
Deep Dive with Spark Streaming - Tathagata Das - Spark Meetup 2013-06-17
Deep Dive with Spark Streaming - Tathagata  Das - Spark Meetup 2013-06-17Deep Dive with Spark Streaming - Tathagata  Das - Spark Meetup 2013-06-17
Deep Dive with Spark Streaming - Tathagata Das - Spark Meetup 2013-06-17
 
Monitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTapMonitoring MySQL with DTrace/SystemTap
Monitoring MySQL with DTrace/SystemTap
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
Automating Analysis and Exploitation of Embedded Device Firmware
Automating Analysis and Exploitation of Embedded Device FirmwareAutomating Analysis and Exploitation of Embedded Device Firmware
Automating Analysis and Exploitation of Embedded Device Firmware
 
Open Source Systems Performance
Open Source Systems PerformanceOpen Source Systems Performance
Open Source Systems Performance
 
Building Deep Reinforcement Learning Applications on Apache Spark with Analyt...
Building Deep Reinforcement Learning Applications on Apache Spark with Analyt...Building Deep Reinforcement Learning Applications on Apache Spark with Analyt...
Building Deep Reinforcement Learning Applications on Apache Spark with Analyt...
 
Advanced troubleshooting linux performance
Advanced troubleshooting linux performanceAdvanced troubleshooting linux performance
Advanced troubleshooting linux performance
 
So you think you can stream.pptx
So you think you can stream.pptxSo you think you can stream.pptx
So you think you can stream.pptx
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
Apache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmapApache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmap
 

Plus de Orgad Kimchi

Oracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOracle Solaris 11.1 New Features
Oracle Solaris 11.1 New Features
Orgad Kimchi
 
New Generation of SPARC Processors Boosting Oracle S/W Angelo Rajadurai
New Generation of SPARC Processors Boosting Oracle S/W Angelo RajaduraiNew Generation of SPARC Processors Boosting Oracle S/W Angelo Rajadurai
New Generation of SPARC Processors Boosting Oracle S/W Angelo Rajadurai
Orgad Kimchi
 
Oracle Solaris 11 platform for ECI Telecom private cloud infrastructure
Oracle Solaris 11 platform for ECI Telecom private cloud infrastructure Oracle Solaris 11 platform for ECI Telecom private cloud infrastructure
Oracle Solaris 11 platform for ECI Telecom private cloud infrastructure
Orgad Kimchi
 

Plus de Orgad Kimchi (9)

Deploying and Managing Artificial Intelligence Services using the Open Data H...
Deploying and Managing Artificial Intelligence Services using the Open Data H...Deploying and Managing Artificial Intelligence Services using the Open Data H...
Deploying and Managing Artificial Intelligence Services using the Open Data H...
 
Red hat's updates on the cloud & infrastructure strategy
Red hat's updates on the cloud & infrastructure strategyRed hat's updates on the cloud & infrastructure strategy
Red hat's updates on the cloud & infrastructure strategy
 
Red Hat Enteprise Linux Open Stack Platfrom Director
Red Hat Enteprise Linux Open Stack Platfrom DirectorRed Hat Enteprise Linux Open Stack Platfrom Director
Red Hat Enteprise Linux Open Stack Platfrom Director
 
OpenStack for devops environment
OpenStack for devops environment OpenStack for devops environment
OpenStack for devops environment
 
Solaris 11.2 What's New
Solaris 11.2 What's NewSolaris 11.2 What's New
Solaris 11.2 What's New
 
Performance analysis in a multitenant cloud environment Using Hadoop Cluster ...
Performance analysis in a multitenant cloud environment Using Hadoop Cluster ...Performance analysis in a multitenant cloud environment Using Hadoop Cluster ...
Performance analysis in a multitenant cloud environment Using Hadoop Cluster ...
 
Oracle Solaris 11.1 New Features
Oracle Solaris 11.1 New FeaturesOracle Solaris 11.1 New Features
Oracle Solaris 11.1 New Features
 
New Generation of SPARC Processors Boosting Oracle S/W Angelo Rajadurai
New Generation of SPARC Processors Boosting Oracle S/W Angelo RajaduraiNew Generation of SPARC Processors Boosting Oracle S/W Angelo Rajadurai
New Generation of SPARC Processors Boosting Oracle S/W Angelo Rajadurai
 
Oracle Solaris 11 platform for ECI Telecom private cloud infrastructure
Oracle Solaris 11 platform for ECI Telecom private cloud infrastructure Oracle Solaris 11 platform for ECI Telecom private cloud infrastructure
Oracle Solaris 11 platform for ECI Telecom private cloud infrastructure
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Cloud Observation and Performance Analysis using Solaris 11 DTrace

  • 1. DTrace, for Solaris (zones inside) and Java  Amit Hurvitz, ISV Engineering, Oracle
  • 2. Program Agenda  Introductory Demo  What's Dtrace?  Enabling Dtrace from Inside the Zone  Java Statically Defined Tracing  TCP Client and Server Flow Tracing - Demo  Future Thoughts
  • 3. Int roduc t ory D o em
  • 4. What's DTrace? - cont.  Zero performance impact when not in use  Completely safe; no way to cause panics, crashes, data corruption or pathological performance degradation  Powerful data management primitives eliminate need for most postprocessing
  • 5. DTrace – D Language probe description /predicate/ { actions } Probes Which events we are interested in monitoring  Predicates (optional) When do we want to monitor the events  Actions (optional) What do we want to do when the above happens   One liner  # dtrace -n 'probe/predicate/{actions}' {actions}
  • 6. DTrace – Probes  Programmable sensors (points of instrumentation) made available by providers placed all over the Solaris system  provider:module:function:name − tcp:ip:tcp_send:entry − Syscall:::  Providers: syscall,io,pid,profile, hotspot, tcp, udp, ip, iscsi,...  Modules: nfs, zfs, cpc, …  Names: entry,return  Listing Probes  # dtrace -l [-P provider | -m module | -f function name | -n name]
  • 7. DTrace – Predicates and Actions  Predicates  /cpu == 0/  /execname == “date”/  /ppid != 0 && arg0 != 0/  Actions  Commands separated by “;”  trace(execname)  printf(“%s %s %s”, execname, probefunc, copyinstr(arg0));  Predefined Variables  execname, probefunc, pid, ppid, cpu, timestamp, arg0, arg1, ...
  • 8. DTrace – Aggregations  Used to aggregate data and look for trends  Has the general form:  @name[keys] = aggfunc(args)  Aggregating functions  count(), sum(), avg(), min(), max(), quantize(), lquantize()  Examples:  % dtrace -n 'syscall::read*:entry{@[execname]=count();}'  % dtrace -n 'syscall::read*:entry{@[execname,arg0]=count();}'
  • 9. An Example – Off-CPU Tracing #!/usr/sbin/dtrace -s BEGIN { start_timestamp = timestamp; } sched:::off-cpu /pid == $1/ { self->ts = timestamp; } sched:::on-cpu /self->ts/ { @[stack(), jstack(), "ns"] = sum(timestamp - self->ts); self->ts = 0; } END { printf("elapsed time: %dn", timestamp - start_timestamp); }
  • 11. Java Statically Defined Tracing (JSDT)  Make points of interest in your application easily monitored  Insert your own DTrace probes in desired locations inside your methods – Use them in conjunction with any other probes #!/usr/sbin/dtrace -s MyProvider:::start { self->start_time = timestamp; } syscall:::entry /self->start_time/ { @[probefunc] = quantize(); }
  • 12. JSDT – define a Provider public interface MyProvider extends com.sun.tracing.Provider { Provider Interface void methodEntry(); void methodReturn(); void start(); void dataAdded(int x, int y); void myProbe(int intData, String stringData); }
  • 13. JSDT – insert probes to your Java code import com.sun.tracing.*; Provider Interface MyProvider provider; public static void main(String args) { ProviderFactory factory = ProviderFactory.getDefaultFactory(); provider = factory.createProvider(MyProvider.class); } public void method() { provider.methodEntry(); ... provider.myProbe(i, str); ... provider.methodReturn(); } Call probes actions Create the provider
  • 14. Fl ow Trac e- D o em
  • 15. Next Thoughts  A special ‘Java-DTrace’ utility to do implicit instrumentation  Probes look like native DTrace PID provider: − −   JDDT$target:class-name:method-name:entry JDDT$target:class-name:method-name:return # jdtrace java-dtrace-script.d -p <process-id> jdtrace will take care of all required dynamic instrumentation −  Clean instrumented code on script end Any suggestions?