Merge lp:~trond-norbye/drizzle/dtrace-macosx-support into lp:~drizzle-trunk/drizzle/development

Proposed by Trond Norbye
Status: Merged
Approved by: Jay Pipes
Approved revision: 1151
Merged at revision: not available
Proposed branch: lp:~trond-norbye/drizzle/dtrace-macosx-support
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: None lines
To merge this branch: bzr merge lp:~trond-norbye/drizzle/dtrace-macosx-support
Reviewer Review Type Date Requested Status
Padraig O'Sullivan (community) Approve
Review via email: mp+11883@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Trond Norbye (trond-norbye) wrote :

Hi,

I couldn't resist to test this today and I noticed that it was so simple that I thought I should send you a patch :-)

With this patch you can add --enable-dtrace on Mac OSX as well :-)

Cheers,

Trond

Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

Cool, looks good to me! Should I merge this in to my branch or will I just let Monty or Jay pull it in one of their captain branches?

-Padraig

review: Approve
Revision history for this message
Trond Norbye (trond-norbye) wrote :

On 17. sep.. 2009, at 02.15, Padraig O'Sullivan wrote:

> Review: Approve
> Cool, looks good to me! Should I merge this in to my branch or will
> I just let Monty or Jay pull it in one of their captain branches?
>

It was for your branch... I had written something wrong in the text
field so it complained to me and when I then resubmitted the field it
had toggled it back to lp:drizzle instead of just you :(

Cheers

Trond

Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

I'll merge it in to my branch and re-submit my branch.

Thanks again,
Padraig

Revision history for this message
Jay Pipes (jaypipes) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/Makefile.am'
2--- drizzled/Makefile.am 2009-08-27 00:39:15 +0000
3+++ drizzled/Makefile.am 2009-09-16 13:51:30 +0000
4@@ -18,10 +18,16 @@
5
6 DTRACEFILES = handler.o \
7 filesort.o \
8+ drizzled.o \
9+ session.o \
10 sql_delete.o \
11 sql_insert.o \
12 sql_select.o \
13- sql_update.o
14+ sql_update.o \
15+ sql_parse.o \
16+ statement/delete.o \
17+ statement/insert.o \
18+ statement/insert_select.o
19
20 drizzledincludedir = ${includedir}/drizzled
21 nobase_dist_drizzledinclude_HEADERS = \
22@@ -694,10 +700,6 @@
23 util/convert.cc \
24 xid.cc
25
26-if HAVE_DTRACE
27-drizzled_SOURCES += probes.d
28-endif
29-
30 libserialutil_la_SOURCES = db.cc table_proto_write.cc
31 libserialutil_la_CXXFLAGS= ${AM_CXXFLAGS} ${PROTOSKIP_WARNINGS}
32
33@@ -725,7 +727,7 @@
34 BUILT_SOURCES = $(BUILT_MAINT_SRC) \
35 symbol_hash.h \
36 function_hash.h \
37- $(PCHHEADERS)
38+ $(PCHHEADERS)
39
40 EXTRA_DIST = \
41 $(BUILT_MAINT_SRC) \
42@@ -744,16 +746,29 @@
43 $(PCHHEADERS) \
44 $(nodist_drizzled_SOURCES)
45
46+if DTRACE_NEEDS_OBJECTS
47+drizzled_SOURCES += probes.d
48+endif
49+
50+if HAVE_DTRACE
51+BUILT_SOURCES += generated_probes.h
52+CLEANFILES += generated_probes.h
53+endif
54+
55+
56 DISTCLEANFILES = $(EXTRA_PROGRAMS) \
57 $(BUILT_MAINT_SRC)
58
59 MAINTAINERCLEANFILES = $(BUILT_MAINT_SRC)
60
61-probes.h: probes.d
62- $(DTRACE) $(DTRACEFLAGS) -h -s probes.d
63- mv probes.h probes.h.bak
64- sed "s/#include <unistd.h>//g" probes.h.bak > probes.h
65- rm probes.h.bak
66+generated_probes.h : probes.d
67+ $(DTRACE) $(DTRACEFLAGS) -h -s probes.d -o generated_probes.h
68+ mv generated_probes.h generated_probes.h.bak
69+ sed "s/#include <unistd.h>//g" generated_probes.h.bak > generated_probes.h
70+ rm generated_probes.h.bak
71+ sed -e 's,void \*,const void \*,g' generated_probes.h | \
72+ sed -e 's,char \*,const char \*,g' | tr '\t' ' ' > dtrace_probes.tmp
73+ mv dtrace_probes.tmp generated_probes.h
74
75
76 SUFFIXES = .d .gch .gperf .stamp-h
77
78=== modified file 'drizzled/drizzled.cc'
79--- drizzled/drizzled.cc 2009-08-24 14:57:56 +0000
80+++ drizzled/drizzled.cc 2009-09-13 04:30:14 +0000
81@@ -45,6 +45,7 @@
82 #include <drizzled/scheduling.h>
83 #include "drizzled/temporal_format.h" /* For init_temporal_formats() */
84 #include "drizzled/slot/listen.h"
85+#include "drizzled/probes.h"
86
87 #include <google/protobuf/stubs/common.h>
88
89@@ -456,6 +457,7 @@
90 tmp= *it;
91 tmp->killed= Session::KILL_CONNECTION;
92 tmp->scheduler->killSession(tmp);
93+ DRIZZLE_CONNECTION_DONE(tmp->thread_id);
94 if (tmp->mysys_var)
95 {
96 tmp->mysys_var->abort=1;
97@@ -766,6 +768,7 @@
98 {
99 statistic_increment(killed_threads, &LOCK_status);
100 session->scheduler->killSessionNow(session);
101+ DRIZZLE_CONNECTION_DONE(session->thread_id);
102 }
103 return;
104 }
105
106=== modified file 'drizzled/filesort.cc'
107--- drizzled/filesort.cc 2009-08-20 20:29:18 +0000
108+++ drizzled/filesort.cc 2009-09-13 01:09:19 +0000
109@@ -114,7 +114,7 @@
110 TableList *tab= table->pos_in_table_list;
111 Item_subselect *subselect= tab ? tab->containing_subselect() : 0;
112
113- DRIZZLE_FILESORT_START();
114+ DRIZZLE_FILESORT_START(table->s->db.str, table->s->table_name.str);
115
116 /*
117 Release InnoDB's adaptive hash index latch (if holding) before
118@@ -324,8 +324,8 @@
119 (uint32_t) records, &LOCK_status);
120 *examined_rows= param.examined_rows;
121 memcpy(&table->sort, &table_sort, sizeof(filesort_info_st));
122- DRIZZLE_FILESORT_END();
123- return(error ? HA_POS_ERROR : records);
124+ DRIZZLE_FILESORT_DONE(error, records);
125+ return (error ? HA_POS_ERROR : records);
126 } /* filesort */
127
128
129
130=== modified file 'drizzled/handler.cc'
131--- drizzled/handler.cc 2009-08-23 01:10:19 +0000
132+++ drizzled/handler.cc 2009-09-14 01:25:59 +0000
133@@ -2696,9 +2696,9 @@
134 We cache the table flags if the locking succeeded. Otherwise, we
135 keep them as they were when they were fetched in ha_open().
136 */
137- DRIZZLE_EXTERNAL_LOCK(lock_type);
138
139 int error= external_lock(session, lock_type);
140+
141 if (error == 0)
142 cached_table_flags= table_flags();
143 return error;
144@@ -2729,7 +2729,6 @@
145 int handler::ha_write_row(unsigned char *buf)
146 {
147 int error;
148- DRIZZLE_INSERT_ROW_START();
149
150 /*
151 * If we have a timestamp column, update it to the current time
152@@ -2743,12 +2742,13 @@
153 mark_trx_read_write();
154
155 if (unlikely(error= write_row(buf)))
156+ {
157 return error;
158+ }
159
160 if (unlikely(log_row_for_replication(table, 0, buf)))
161 return HA_ERR_RBR_LOGGING_FAILED; /* purecov: inspected */
162
163- DRIZZLE_INSERT_ROW_END();
164 return 0;
165 }
166
167@@ -2766,7 +2766,9 @@
168 mark_trx_read_write();
169
170 if (unlikely(error= update_row(old_data, new_data)))
171+ {
172 return error;
173+ }
174
175 if (unlikely(log_row_for_replication(table, old_data, new_data)))
176 return HA_ERR_RBR_LOGGING_FAILED;
177
178=== modified file 'drizzled/probes.d'
179--- drizzled/probes.d 2008-11-01 00:46:20 +0000
180+++ drizzled/probes.d 2009-09-14 20:44:27 +0000
181@@ -1,7 +1,7 @@
182 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
183 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
184 *
185- * Copyright (C) 2008 Sun Microsystems
186+ * Copyright (C) 2009 Sun Microsystems
187 *
188 * This program is free software; you can redistribute it and/or modify
189 * it under the terms of the GNU General Public License as published by
190@@ -17,18 +17,107 @@
191 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
192 */
193
194+/*
195+ The actual probe names in DTrace scripts will replace '__' by '-'. Thus
196+ insert__row__start will be insert-row-start.
197+
198+ Recommendations for adding new probes:
199+
200+ - each probe should have the minimal set of arguments required to
201+ unambiguously identify the context in which the probe fires. Redundant
202+ probes (i.e. the ones that can be obtained in user scripts from previous
203+ probes' arguments or otherwise) may be added for convenience.
204+
205+ - try to avoid computationally expensive probe arguments. If impossible,
206+ use *_ENABLED() macros to check if the probe is activated before
207+ performing expensive calculations for a probe argument.
208+
209+ - all *-done probes should have a status argument wherever applicable to make
210+ it possible for user scripts to figure out whether the completed operation
211+ was successful or not.
212+
213+ - for all status arguments, a non-zero value should be returned on error or
214+ failure, 0 should be returned on success.
215+*/
216+
217 provider drizzle {
218-probe external_lock(int);
219-probe insert_row_start();
220-probe insert_row_end();
221-probe filesort_start();
222-probe filesort_end();
223-probe delete_start();
224-probe delete_end();
225-probe insert_start();
226-probe insert_end();
227-probe select_start();
228-probe select_end();
229-probe update_start();
230-probe update_end();
231+
232+ /* The following ones fire when creating or closing a client connection */
233+ probe connection__start(unsigned long conn_id);
234+ probe connection__done(unsigned long conn_id);
235+
236+ /*
237+ * Fire at the start/end of any client command processing (including SQL
238+ * queries).
239+ */
240+ probe command__start(unsigned long conn_id, int command);
241+ probe command__done(int status);
242+
243+ /*
244+ * The following probes fire at the start/end of any SQL query processing,
245+ * respectively.
246+ *
247+ * query_start() has a lot of parameters that can be used to pick up
248+ * parameters for a lot of other probes here. For simplicity reasons we also
249+ * add the query string to most other DTrace probes as well. Hostname is
250+ * either the hostname or the IP address of the Drizzle client.
251+ */
252+ probe query__start(const char *query,
253+ unsigned long conn_id,
254+ const char *db_name);
255+ probe query__done(int status);
256+
257+ /* Fire at the start/end of SQL query parsing */
258+ probe query__parse__start(const char *query);
259+ probe query__parse__done(int status);
260+
261+ /*
262+ * This probe fires when the actual query execution starts
263+ */
264+ probe query__exec__start(const char *query,
265+ unsigned long connid,
266+ const char *db_name);
267+ probe query__exec__done(int status);
268+
269+ /* These probes fire when performing write operations towards any handler */
270+ probe insert__row__start(const char *db, const char *table);
271+ probe insert__row__done(int status);
272+ probe update__row__start(const char *db, const char *table);
273+ probe update__row__done(int status);
274+ probe delete__row__start(const char *db, const char *table);
275+ probe delete__row__done(int status);
276+
277+ /*
278+ * These probes fire when calling external_lock for any handler
279+ * depending on the lock type being acquired or released.
280+ */
281+ probe handler__rdlock__start(const char *db, const char *table);
282+ probe handler__wrlock__start(const char *db, const char *table);
283+ probe handler__unlock__start(const char *db, const char *table);
284+ probe handler__rdlock__done(int status);
285+ probe handler__wrlock__done(int status);
286+ probe handler__unlock__done(int status);
287+
288+ /*
289+ * These probes fire when a filesort activity happens in a query.
290+ */
291+ probe filesort__start(const char *db, const char *table);
292+ probe filesort__done(int status, unsigned long rows);
293+ /*
294+ * The query types SELECT, INSERT, INSERT AS SELECT, UPDATE, DELETE
295+ * are all probed.
296+ * The start probe always contains the query text.
297+ */
298+ probe select__start(const char *query);
299+ probe select__done(int status, unsigned long rows);
300+ probe insert__start(const char *query);
301+ probe insert__done(int status, unsigned long rows);
302+ probe insert__select__start(const char *query);
303+ probe insert__select__done(int status, unsigned long rows);
304+ probe update__start(const char *query);
305+ probe update__done(int status,
306+ unsigned long rowsmatches, unsigned long rowschanged);
307+ probe delete__start(const char *query);
308+ probe delete__done(int status, unsigned long rows);
309+
310 };
311
312=== added file 'drizzled/probes.h'
313--- drizzled/probes.h 1970-01-01 00:00:00 +0000
314+++ drizzled/probes.h 2009-09-14 20:12:21 +0000
315@@ -0,0 +1,97 @@
316+/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
317+ * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
318+ *
319+ * Copyright (C) 2009 Sun Microsystems
320+ *
321+ * This program is free software; you can redistribute it and/or modify
322+ * it under the terms of the GNU General Public License as published by
323+ * the Free Software Foundation; either version 2 of the License, or
324+ * (at your option) any later version.
325+ *
326+ * This program is distributed in the hope that it will be useful,
327+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
328+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
329+ * GNU General Public License for more details.
330+ *
331+ * You should have received a copy of the GNU General Public License
332+ * along with this program; if not, write to the Free Software
333+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
334+ */
335+
336+#ifndef DRIZZLED_PROBES_H
337+#define DRIZZLED_PROBES_H
338+
339+#ifdef HAVE_DTRACE
340+#include "drizzled/generated_probes.h"
341+#else
342+#define DRIZZLE_COMMAND_DONE(arg0)
343+#define DRIZZLE_COMMAND_DONE_ENABLED() (0)
344+#define DRIZZLE_COMMAND_START(arg0, arg1)
345+#define DRIZZLE_COMMAND_START_ENABLED() (0)
346+#define DRIZZLE_CONNECTION_DONE(arg0)
347+#define DRIZZLE_CONNECTION_DONE_ENABLED() (0)
348+#define DRIZZLE_CONNECTION_START(arg0)
349+#define DRIZZLE_CONNECTION_START_ENABLED() (0)
350+#define DRIZZLE_DELETE_DONE(arg0, arg1)
351+#define DRIZZLE_DELETE_DONE_ENABLED() (0)
352+#define DRIZZLE_DELETE_ROW_DONE(arg0)
353+#define DRIZZLE_DELETE_ROW_DONE_ENABLED() (0)
354+#define DRIZZLE_DELETE_ROW_START(arg0, arg1)
355+#define DRIZZLE_DELETE_ROW_START_ENABLED() (0)
356+#define DRIZZLE_DELETE_START(arg0)
357+#define DRIZZLE_DELETE_START_ENABLED() (0)
358+#define DRIZZLE_FILESORT_DONE(arg0, arg1)
359+#define DRIZZLE_FILESORT_DONE_ENABLED() (0)
360+#define DRIZZLE_FILESORT_START(arg0, arg1)
361+#define DRIZZLE_FILESORT_START_ENABLED() (0)
362+#define DRIZZLE_HANDLER_RDLOCK_DONE(arg0)
363+#define DRIZZLE_HANDLER_RDLOCK_DONE_ENABLED() (0)
364+#define DRIZZLE_HANDLER_RDLOCK_START(arg0, arg1)
365+#define DRIZZLE_HANDLER_RDLOCK_START_ENABLED() (0)
366+#define DRIZZLE_HANDLER_UNLOCK_DONE(arg0)
367+#define DRIZZLE_HANDLER_UNLOCK_DONE_ENABLED() (0)
368+#define DRIZZLE_HANDLER_UNLOCK_START(arg0, arg1)
369+#define DRIZZLE_HANDLER_UNLOCK_START_ENABLED() (0)
370+#define DRIZZLE_HANDLER_WRLOCK_DONE(arg0)
371+#define DRIZZLE_HANDLER_WRLOCK_DONE_ENABLED() (0)
372+#define DRIZZLE_HANDLER_WRLOCK_START(arg0, arg1)
373+#define DRIZZLE_HANDLER_WRLOCK_START_ENABLED() (0)
374+#define DRIZZLE_INSERT_DONE(arg0, arg1)
375+#define DRIZZLE_INSERT_DONE_ENABLED() (0)
376+#define DRIZZLE_INSERT_ROW_DONE(arg0)
377+#define DRIZZLE_INSERT_ROW_DONE_ENABLED() (0)
378+#define DRIZZLE_INSERT_ROW_START(arg0, arg1)
379+#define DRIZZLE_INSERT_ROW_START_ENABLED() (0)
380+#define DRIZZLE_INSERT_SELECT_DONE(arg0, arg1)
381+#define DRIZZLE_INSERT_SELECT_DONE_ENABLED() (0)
382+#define DRIZZLE_INSERT_SELECT_START(arg0)
383+#define DRIZZLE_INSERT_SELECT_START_ENABLED() (0)
384+#define DRIZZLE_INSERT_START(arg0)
385+#define DRIZZLE_INSERT_START_ENABLED() (0)
386+#define DRIZZLE_QUERY_DONE(arg0)
387+#define DRIZZLE_QUERY_DONE_ENABLED() (0)
388+#define DRIZZLE_QUERY_EXEC_DONE(arg0)
389+#define DRIZZLE_QUERY_EXEC_DONE_ENABLED() (0)
390+#define DRIZZLE_QUERY_EXEC_START(arg0, arg1, arg2)
391+#define DRIZZLE_QUERY_EXEC_START_ENABLED() (0)
392+#define DRIZZLE_QUERY_PARSE_DONE(arg0)
393+#define DRIZZLE_QUERY_PARSE_DONE_ENABLED() (0)
394+#define DRIZZLE_QUERY_PARSE_START(arg0)
395+#define DRIZZLE_QUERY_PARSE_START_ENABLED() (0)
396+#define DRIZZLE_QUERY_START(arg0, arg1, arg2)
397+#define DRIZZLE_QUERY_START_ENABLED() (0)
398+#define DRIZZLE_SELECT_DONE(arg0, arg1)
399+#define DRIZZLE_SELECT_DONE_ENABLED() (0)
400+#define DRIZZLE_SELECT_START(arg0)
401+#define DRIZZLE_SELECT_START_ENABLED() (0)
402+#define DRIZZLE_UPDATE_DONE(arg0, arg1, arg2)
403+#define DRIZZLE_UPDATE_DONE_ENABLED() (0)
404+#define DRIZZLE_UPDATE_ROW_DONE(arg0)
405+#define DRIZZLE_UPDATE_ROW_DONE_ENABLED() (0)
406+#define DRIZZLE_UPDATE_ROW_START(arg0, arg1)
407+#define DRIZZLE_UPDATE_ROW_START_ENABLED() (0)
408+#define DRIZZLE_UPDATE_START(arg0)
409+#define DRIZZLE_UPDATE_START_ENABLED() (0)
410+#endif
411+
412+#endif /* DRIZZLED_PROBES_H */
413
414=== removed file 'drizzled/probes.h'
415--- drizzled/probes.h 2009-05-21 17:05:14 +0000
416+++ drizzled/probes.h 1970-01-01 00:00:00 +0000
417@@ -1,250 +0,0 @@
418-/*
419- * Generated by dtrace(1M).
420- */
421-
422-#ifndef _PROBES_H
423-#define _PROBES_H
424-
425-
426-
427-#ifdef __cplusplus
428-extern "C" {
429-#endif
430-
431-#if _DTRACE_VERSION
432-
433-#define DRIZZLE_DELETE_END() \
434- __dtrace_drizzle___delete_end()
435-#ifndef __sparc
436-#define DRIZZLE_DELETE_END_ENABLED() \
437- __dtraceenabled_drizzle___delete_end()
438-#else
439-#define DRIZZLE_DELETE_END_ENABLED() \
440- __dtraceenabled_drizzle___delete_end(0)
441-#endif
442-#define DRIZZLE_DELETE_START() \
443- __dtrace_drizzle___delete_start()
444-#ifndef __sparc
445-#define DRIZZLE_DELETE_START_ENABLED() \
446- __dtraceenabled_drizzle___delete_start()
447-#else
448-#define DRIZZLE_DELETE_START_ENABLED() \
449- __dtraceenabled_drizzle___delete_start(0)
450-#endif
451-#define DRIZZLE_EXTERNAL_LOCK(arg0) \
452- __dtrace_drizzle___external_lock(arg0)
453-#ifndef __sparc
454-#define DRIZZLE_EXTERNAL_LOCK_ENABLED() \
455- __dtraceenabled_drizzle___external_lock()
456-#else
457-#define DRIZZLE_EXTERNAL_LOCK_ENABLED() \
458- __dtraceenabled_drizzle___external_lock(0)
459-#endif
460-#define DRIZZLE_FILESORT_END() \
461- __dtrace_drizzle___filesort_end()
462-#ifndef __sparc
463-#define DRIZZLE_FILESORT_END_ENABLED() \
464- __dtraceenabled_drizzle___filesort_end()
465-#else
466-#define DRIZZLE_FILESORT_END_ENABLED() \
467- __dtraceenabled_drizzle___filesort_end(0)
468-#endif
469-#define DRIZZLE_FILESORT_START() \
470- __dtrace_drizzle___filesort_start()
471-#ifndef __sparc
472-#define DRIZZLE_FILESORT_START_ENABLED() \
473- __dtraceenabled_drizzle___filesort_start()
474-#else
475-#define DRIZZLE_FILESORT_START_ENABLED() \
476- __dtraceenabled_drizzle___filesort_start(0)
477-#endif
478-#define DRIZZLE_INSERT_END() \
479- __dtrace_drizzle___insert_end()
480-#ifndef __sparc
481-#define DRIZZLE_INSERT_END_ENABLED() \
482- __dtraceenabled_drizzle___insert_end()
483-#else
484-#define DRIZZLE_INSERT_END_ENABLED() \
485- __dtraceenabled_drizzle___insert_end(0)
486-#endif
487-#define DRIZZLE_INSERT_ROW_END() \
488- __dtrace_drizzle___insert_row_end()
489-#ifndef __sparc
490-#define DRIZZLE_INSERT_ROW_END_ENABLED() \
491- __dtraceenabled_drizzle___insert_row_end()
492-#else
493-#define DRIZZLE_INSERT_ROW_END_ENABLED() \
494- __dtraceenabled_drizzle___insert_row_end(0)
495-#endif
496-#define DRIZZLE_INSERT_ROW_START() \
497- __dtrace_drizzle___insert_row_start()
498-#ifndef __sparc
499-#define DRIZZLE_INSERT_ROW_START_ENABLED() \
500- __dtraceenabled_drizzle___insert_row_start()
501-#else
502-#define DRIZZLE_INSERT_ROW_START_ENABLED() \
503- __dtraceenabled_drizzle___insert_row_start(0)
504-#endif
505-#define DRIZZLE_INSERT_START() \
506- __dtrace_drizzle___insert_start()
507-#ifndef __sparc
508-#define DRIZZLE_INSERT_START_ENABLED() \
509- __dtraceenabled_drizzle___insert_start()
510-#else
511-#define DRIZZLE_INSERT_START_ENABLED() \
512- __dtraceenabled_drizzle___insert_start(0)
513-#endif
514-#define DRIZZLE_SELECT_END() \
515- __dtrace_drizzle___select_end()
516-#ifndef __sparc
517-#define DRIZZLE_SELECT_END_ENABLED() \
518- __dtraceenabled_drizzle___select_end()
519-#else
520-#define DRIZZLE_SELECT_END_ENABLED() \
521- __dtraceenabled_drizzle___select_end(0)
522-#endif
523-#define DRIZZLE_SELECT_START() \
524- __dtrace_drizzle___select_start()
525-#ifndef __sparc
526-#define DRIZZLE_SELECT_START_ENABLED() \
527- __dtraceenabled_drizzle___select_start()
528-#else
529-#define DRIZZLE_SELECT_START_ENABLED() \
530- __dtraceenabled_drizzle___select_start(0)
531-#endif
532-#define DRIZZLE_UPDATE_END() \
533- __dtrace_drizzle___update_end()
534-#ifndef __sparc
535-#define DRIZZLE_UPDATE_END_ENABLED() \
536- __dtraceenabled_drizzle___update_end()
537-#else
538-#define DRIZZLE_UPDATE_END_ENABLED() \
539- __dtraceenabled_drizzle___update_end(0)
540-#endif
541-#define DRIZZLE_UPDATE_START() \
542- __dtrace_drizzle___update_start()
543-#ifndef __sparc
544-#define DRIZZLE_UPDATE_START_ENABLED() \
545- __dtraceenabled_drizzle___update_start()
546-#else
547-#define DRIZZLE_UPDATE_START_ENABLED() \
548- __dtraceenabled_drizzle___update_start(0)
549-#endif
550-
551-
552-extern void __dtrace_drizzle___delete_end(void);
553-#ifndef __sparc
554-extern int __dtraceenabled_drizzle___delete_end(void);
555-#else
556-extern int __dtraceenabled_drizzle___delete_end(long);
557-#endif
558-extern void __dtrace_drizzle___delete_start(void);
559-#ifndef __sparc
560-extern int __dtraceenabled_drizzle___delete_start(void);
561-#else
562-extern int __dtraceenabled_drizzle___delete_start(long);
563-#endif
564-extern void __dtrace_drizzle___external_lock(int);
565-#ifndef __sparc
566-extern int __dtraceenabled_drizzle___external_lock(void);
567-#else
568-extern int __dtraceenabled_drizzle___external_lock(long);
569-#endif
570-extern void __dtrace_drizzle___filesort_end(void);
571-#ifndef __sparc
572-extern int __dtraceenabled_drizzle___filesort_end(void);
573-#else
574-extern int __dtraceenabled_drizzle___filesort_end(long);
575-#endif
576-extern void __dtrace_drizzle___filesort_start(void);
577-#ifndef __sparc
578-extern int __dtraceenabled_drizzle___filesort_start(void);
579-#else
580-extern int __dtraceenabled_drizzle___filesort_start(long);
581-#endif
582-extern void __dtrace_drizzle___insert_end(void);
583-#ifndef __sparc
584-extern int __dtraceenabled_drizzle___insert_end(void);
585-#else
586-extern int __dtraceenabled_drizzle___insert_end(long);
587-#endif
588-extern void __dtrace_drizzle___insert_row_end(void);
589-#ifndef __sparc
590-extern int __dtraceenabled_drizzle___insert_row_end(void);
591-#else
592-extern int __dtraceenabled_drizzle___insert_row_end(long);
593-#endif
594-extern void __dtrace_drizzle___insert_row_start(void);
595-#ifndef __sparc
596-extern int __dtraceenabled_drizzle___insert_row_start(void);
597-#else
598-extern int __dtraceenabled_drizzle___insert_row_start(long);
599-#endif
600-extern void __dtrace_drizzle___insert_start(void);
601-#ifndef __sparc
602-extern int __dtraceenabled_drizzle___insert_start(void);
603-#else
604-extern int __dtraceenabled_drizzle___insert_start(long);
605-#endif
606-extern void __dtrace_drizzle___select_end(void);
607-#ifndef __sparc
608-extern int __dtraceenabled_drizzle___select_end(void);
609-#else
610-extern int __dtraceenabled_drizzle___select_end(long);
611-#endif
612-extern void __dtrace_drizzle___select_start(void);
613-#ifndef __sparc
614-extern int __dtraceenabled_drizzle___select_start(void);
615-#else
616-extern int __dtraceenabled_drizzle___select_start(long);
617-#endif
618-extern void __dtrace_drizzle___update_end(void);
619-#ifndef __sparc
620-extern int __dtraceenabled_drizzle___update_end(void);
621-#else
622-extern int __dtraceenabled_drizzle___update_end(long);
623-#endif
624-extern void __dtrace_drizzle___update_start(void);
625-#ifndef __sparc
626-extern int __dtraceenabled_drizzle___update_start(void);
627-#else
628-extern int __dtraceenabled_drizzle___update_start(long);
629-#endif
630-
631-#else
632-
633-#define DRIZZLE_DELETE_END()
634-#define DRIZZLE_DELETE_END_ENABLED() (0)
635-#define DRIZZLE_DELETE_START()
636-#define DRIZZLE_DELETE_START_ENABLED() (0)
637-#define DRIZZLE_EXTERNAL_LOCK(arg0)
638-#define DRIZZLE_EXTERNAL_LOCK_ENABLED() (0)
639-#define DRIZZLE_FILESORT_END()
640-#define DRIZZLE_FILESORT_END_ENABLED() (0)
641-#define DRIZZLE_FILESORT_START()
642-#define DRIZZLE_FILESORT_START_ENABLED() (0)
643-#define DRIZZLE_INSERT_END()
644-#define DRIZZLE_INSERT_END_ENABLED() (0)
645-#define DRIZZLE_INSERT_ROW_END()
646-#define DRIZZLE_INSERT_ROW_END_ENABLED() (0)
647-#define DRIZZLE_INSERT_ROW_START()
648-#define DRIZZLE_INSERT_ROW_START_ENABLED() (0)
649-#define DRIZZLE_INSERT_START()
650-#define DRIZZLE_INSERT_START_ENABLED() (0)
651-#define DRIZZLE_SELECT_END()
652-#define DRIZZLE_SELECT_END_ENABLED() (0)
653-#define DRIZZLE_SELECT_START()
654-#define DRIZZLE_SELECT_START_ENABLED() (0)
655-#define DRIZZLE_UPDATE_END()
656-#define DRIZZLE_UPDATE_END_ENABLED() (0)
657-#define DRIZZLE_UPDATE_START()
658-#define DRIZZLE_UPDATE_START_ENABLED() (0)
659-
660-#endif
661-
662-
663-#ifdef __cplusplus
664-}
665-#endif
666-
667-#endif /* _PROBES_H */
668
669=== modified file 'drizzled/session.cc'
670--- drizzled/session.cc 2009-08-16 14:14:39 +0000
671+++ drizzled/session.cc 2009-09-13 04:30:14 +0000
672@@ -37,6 +37,7 @@
673 #include <drizzled/item/empty_string.h>
674 #include <drizzled/show.h>
675 #include <drizzled/scheduling.h>
676+#include "drizzled/probes.h"
677
678 #include <algorithm>
679
680@@ -481,6 +482,7 @@
681 if (state_to_set != Session::KILL_QUERY)
682 {
683 scheduler->killSession(this);
684+ DRIZZLE_CONNECTION_DONE(thread_id);
685 }
686 if (mysys_var)
687 {
688@@ -620,6 +622,7 @@
689
690 if (scheduler->addSession(this))
691 {
692+ DRIZZLE_CONNECTION_START(thread_id);
693 char error_message_buff[DRIZZLE_ERRMSG_SIZE];
694
695 killed= Session::KILL_CONNECTION;
696
697=== modified file 'drizzled/sql_delete.cc'
698--- drizzled/sql_delete.cc 2009-08-06 16:51:53 +0000
699+++ drizzled/sql_delete.cc 2009-09-13 04:30:14 +0000
700@@ -25,6 +25,7 @@
701 #include <drizzled/sql_parse.h>
702 #include <drizzled/sql_base.h>
703 #include <drizzled/lock.h>
704+#include "drizzled/probes.h"
705
706 /**
707 Implement DELETE SQL word.
708@@ -50,10 +51,14 @@
709 uint32_t usable_index= MAX_KEY;
710 Select_Lex *select_lex= &session->lex->select_lex;
711 Session::killed_state killed_status= Session::NOT_KILLED;
712+ int res= 0;
713
714
715 if (session->openTablesLock(table_list))
716+ {
717+ DRIZZLE_DELETE_DONE(1, 0);
718 return true;
719+ }
720
721 table= table_list->table;
722 assert(table);
723@@ -162,14 +167,14 @@
724 delete select;
725 free_underlaid_joins(session, select_lex);
726 session->row_count_func= 0;
727- DRIZZLE_DELETE_END();
728+ DRIZZLE_DELETE_DONE(0, 0);
729 session->my_ok((ha_rows) session->row_count_func);
730 /*
731 We don't need to call reset_auto_increment in this case, because
732 mysql_truncate always gives a NULL conds argument, hence we never
733 get here.
734 */
735- return(0); // Nothing to delete
736+ return 0; // Nothing to delete
737 }
738
739 /* If running in safe sql mode, don't allow updates without keys */
740@@ -322,17 +327,18 @@
741 assert(transactional_table || !deleted || session->transaction.stmt.modified_non_trans_table);
742 free_underlaid_joins(session, select_lex);
743
744- DRIZZLE_DELETE_END();
745+ res= (error >= 0 || session->is_error());
746+ DRIZZLE_DELETE_DONE(res, deleted);
747 if (error < 0 || (session->lex->ignore && !session->is_fatal_error))
748 {
749 session->row_count_func= deleted;
750 session->my_ok((ha_rows) session->row_count_func);
751 }
752- return(error >= 0 || session->is_error());
753+ return (error >= 0 || session->is_error());
754
755 err:
756- DRIZZLE_DELETE_END();
757- return(true);
758+ DRIZZLE_DELETE_DONE(1, 0);
759+ return true;
760 }
761
762
763
764=== modified file 'drizzled/sql_insert.cc'
765--- drizzled/sql_insert.cc 2009-08-24 14:57:56 +0000
766+++ drizzled/sql_insert.cc 2009-09-13 04:30:14 +0000
767@@ -240,7 +240,10 @@
768 values_list.elements > 1);
769
770 if (session->openTablesLock(table_list))
771+ {
772+ DRIZZLE_INSERT_DONE(1, 0);
773 return true;
774+ }
775
776 lock_type= table_list->lock_type;
777
778@@ -466,8 +469,8 @@
779 info.copied + info.deleted + info.touched, id, buff);
780 }
781 session->abort_on_warning= 0;
782- DRIZZLE_INSERT_END();
783- return(false);
784+ DRIZZLE_INSERT_DONE(0, session->row_count_func);
785+ return false;
786
787 abort:
788 if (table != NULL)
789@@ -475,8 +478,8 @@
790 if (!joins_freed)
791 free_underlaid_joins(session, &session->lex->select_lex);
792 session->abort_on_warning= 0;
793- DRIZZLE_INSERT_END();
794- return(true);
795+ DRIZZLE_INSERT_DONE(1, 0);
796+ return true;
797 }
798
799
800@@ -1336,7 +1339,8 @@
801 if (error)
802 {
803 table->file->print_error(error,MYF(0));
804- return(1);
805+ DRIZZLE_INSERT_SELECT_DONE(error, 0);
806+ return 1;
807 }
808 char buff[160];
809 if (info.ignore)
810@@ -1354,7 +1358,8 @@
811 (info.copied ? autoinc_value_of_last_inserted_row : 0));
812 session->my_ok((ulong) session->row_count_func,
813 info.copied + info.deleted + info.touched, id, buff);
814- return(0);
815+ DRIZZLE_INSERT_SELECT_DONE(0, session->row_count_func);
816+ return 0;
817 }
818
819 void select_insert::abort() {
820@@ -1393,6 +1398,11 @@
821 table->file->ha_release_auto_increment();
822 }
823
824+ if (DRIZZLE_INSERT_SELECT_DONE_ENABLED())
825+ {
826+ DRIZZLE_INSERT_SELECT_DONE(0, info.copied + info.deleted + info.updated);
827+ }
828+
829 return;
830 }
831
832
833=== modified file 'drizzled/sql_parse.cc'
834--- drizzled/sql_parse.cc 2009-08-27 01:04:45 +0000
835+++ drizzled/sql_parse.cc 2009-09-14 04:21:55 +0000
836@@ -35,6 +35,7 @@
837 #include <drizzled/lock.h>
838 #include <drizzled/select_send.h>
839 #include <drizzled/statement.h>
840+#include "drizzled/probes.h"
841
842 #include <bitset>
843 #include <algorithm>
844@@ -166,7 +167,10 @@
845 bool error= 0;
846 Query_id &query_id= Query_id::get_query_id();
847
848- session->command=command;
849+ DRIZZLE_COMMAND_START(session->thread_id,
850+ command);
851+
852+ session->command= command;
853 session->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
854 session->set_time();
855 session->query_id= query_id.value();
856@@ -204,6 +208,9 @@
857 {
858 if (! session->readAndStoreQuery(packet, packet_length))
859 break; // fatal error is set
860+ DRIZZLE_QUERY_START(session->query,
861+ session->thread_id,
862+ (char *) (session->db ? session->db : ""));
863 const char* end_of_stmt= NULL;
864
865 mysql_parse(session, session->query, session->query_length, &end_of_stmt);
866@@ -295,15 +302,25 @@
867
868 /* Store temp state for processlist */
869 session->set_proc_info("cleaning up");
870- session->command=COM_SLEEP;
871+ session->command= COM_SLEEP;
872 memset(session->process_list_info, 0, PROCESS_LIST_WIDTH);
873- session->query=0;
874- session->query_length=0;
875+ session->query= 0;
876+ session->query_length= 0;
877
878 session->set_proc_info(NULL);
879 session->packet.shrink(session->variables.net_buffer_length); // Reclaim some memory
880 free_root(session->mem_root,MYF(MY_KEEP_PREALLOC));
881- return(error);
882+
883+ if (DRIZZLE_QUERY_DONE_ENABLED() || DRIZZLE_COMMAND_DONE_ENABLED())
884+ {
885+ if (command == COM_QUERY)
886+ {
887+ DRIZZLE_QUERY_DONE(session->is_error());
888+ }
889+ DRIZZLE_COMMAND_DONE(session->is_error());
890+ }
891+
892+ return error;
893 }
894
895
896@@ -759,8 +776,12 @@
897 if (*found_semicolon &&
898 (session->query_length= (ulong)(*found_semicolon - session->query)))
899 session->query_length--;
900+ DRIZZLE_QUERY_EXEC_START(session->query,
901+ session->thread_id,
902+ (char *) (session->db ? session->db : ""));
903 /* Actually execute the query */
904 mysql_execute_command(session);
905+ DRIZZLE_QUERY_EXEC_DONE(0);
906 }
907 }
908 }
909@@ -1819,6 +1840,8 @@
910 {
911 assert(session->m_lip == NULL);
912
913+ DRIZZLE_QUERY_PARSE_START(session->query);
914+
915 /* Set Lex_input_stream. */
916
917 session->m_lip= lip;
918@@ -1835,6 +1858,8 @@
919
920 session->m_lip= NULL;
921
922+ DRIZZLE_QUERY_PARSE_DONE(mysql_parse_status || session->is_fatal_error);
923+
924 /* That's it. */
925
926 return mysql_parse_status || session->is_fatal_error;
927
928=== modified file 'drizzled/sql_select.cc'
929--- drizzled/sql_select.cc 2009-08-20 21:45:52 +0000
930+++ drizzled/sql_select.cc 2009-09-13 01:44:36 +0000
931@@ -124,7 +124,7 @@
932 {
933 bool res;
934 register Select_Lex *select_lex= &lex->select_lex;
935- DRIZZLE_SELECT_START();
936+ DRIZZLE_SELECT_START(session->query);
937
938 if (select_lex->master_unit()->is_union() ||
939 select_lex->master_unit()->fake_select_lex)
940@@ -157,8 +157,8 @@
941 if (unlikely(res))
942 result->abort();
943
944- DRIZZLE_SELECT_END();
945- return(res);
946+ DRIZZLE_SELECT_DONE(res, session->limit_found_rows);
947+ return res;
948 }
949
950 /*
951
952=== modified file 'drizzled/sql_update.cc'
953--- drizzled/sql_update.cc 2009-08-20 20:29:18 +0000
954+++ drizzled/sql_update.cc 2009-09-13 04:30:14 +0000
955@@ -138,10 +138,14 @@
956 uint64_t id;
957 List<Item> all_fields;
958 Session::killed_state killed_status= Session::NOT_KILLED;
959+ int res= 0;
960
961- DRIZZLE_UPDATE_START();
962+ DRIZZLE_UPDATE_START(session->query);
963 if (session->openTablesLock(table_list))
964+ {
965+ DRIZZLE_UPDATE_DONE(1, 0, 0);
966 return 1;
967+ }
968
969 session->set_proc_info("init");
970 table= table_list->table;
971@@ -179,8 +183,8 @@
972 if (select_lex->inner_refs_list.elements &&
973 fix_inner_refs(session, all_fields, select_lex, select_lex->ref_pointer_array))
974 {
975- DRIZZLE_UPDATE_END();
976- return(-1);
977+ DRIZZLE_UPDATE_DONE(1, 0, 0);
978+ return -1;
979 }
980
981 if (conds)
982@@ -215,9 +219,9 @@
983 free_underlaid_joins(session, select_lex);
984 if (error)
985 goto abort; // Error in where
986- DRIZZLE_UPDATE_END();
987+ DRIZZLE_UPDATE_DONE(0, 0, 0);
988 session->my_ok(); // No matching records
989- return(0);
990+ return 0;
991 }
992 if (!select && limit != HA_POS_ERROR)
993 {
994@@ -627,7 +631,6 @@
995 id= session->arg_of_last_insert_id_function ?
996 session->first_successful_insert_id_in_prev_stmt : 0;
997
998- DRIZZLE_UPDATE_END();
999 if (error < 0)
1000 {
1001 char buff[STRING_BUFFER_USUAL_SIZE];
1002@@ -638,7 +641,9 @@
1003 }
1004 session->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */
1005 session->abort_on_warning= 0;
1006- return((error >= 0 || session->is_error()) ? 1 : 0);
1007+ res= (error >= 0 || session->is_error()) ? 1 : 0;
1008+ DRIZZLE_UPDATE_DONE(res, found, updated);
1009+ return ((error >= 0 || session->is_error()) ? 1 : 0);
1010
1011 err:
1012 delete select;
1013@@ -651,8 +656,8 @@
1014 session->abort_on_warning= 0;
1015
1016 abort:
1017- DRIZZLE_UPDATE_END();
1018- return(1);
1019+ DRIZZLE_UPDATE_DONE(1, 0, 0);
1020+ return 1;
1021 }
1022
1023 /*
1024
1025=== modified file 'drizzled/statement/delete.cc'
1026--- drizzled/statement/delete.cc 2009-08-10 18:03:39 +0000
1027+++ drizzled/statement/delete.cc 2009-09-13 04:30:14 +0000
1028@@ -22,12 +22,14 @@
1029 #include <drizzled/show.h>
1030 #include <drizzled/session.h>
1031 #include <drizzled/lock.h>
1032+#include <drizzled/probes.h>
1033 #include <drizzled/statement/delete.h>
1034
1035 using namespace drizzled;
1036
1037 bool statement::Delete::execute()
1038 {
1039+ DRIZZLE_DELETE_START(session->query);
1040 TableList *first_table= (TableList *) session->lex->select_lex.table_list.first;
1041 TableList *all_tables= session->lex->query_tables;
1042 Select_Lex *select_lex= &session->lex->select_lex;
1043
1044=== modified file 'drizzled/statement/insert.cc'
1045--- drizzled/statement/insert.cc 2009-08-26 23:47:28 +0000
1046+++ drizzled/statement/insert.cc 2009-09-13 04:30:14 +0000
1047@@ -22,6 +22,7 @@
1048 #include <drizzled/show.h>
1049 #include <drizzled/lock.h>
1050 #include <drizzled/session.h>
1051+#include <drizzled/probes.h>
1052 #include <drizzled/statement/insert.h>
1053
1054 using namespace drizzled;
1055@@ -43,6 +44,8 @@
1056 return true;
1057 }
1058
1059+ DRIZZLE_INSERT_START(session->query);
1060+
1061 bool res= mysql_insert(session,
1062 all_tables,
1063 session->lex->field_list,
1064
1065=== modified file 'drizzled/statement/insert_select.cc'
1066--- drizzled/statement/insert_select.cc 2009-08-27 00:39:15 +0000
1067+++ drizzled/statement/insert_select.cc 2009-09-13 04:30:14 +0000
1068@@ -22,6 +22,7 @@
1069 #include <drizzled/show.h>
1070 #include <drizzled/lock.h>
1071 #include <drizzled/session.h>
1072+#include <drizzled/probes.h>
1073 #include <drizzled/statement/insert_select.h>
1074
1075 using namespace drizzled;
1076@@ -54,6 +55,7 @@
1077
1078 if (! (res= session->openTablesLock(all_tables)))
1079 {
1080+ DRIZZLE_INSERT_SELECT_START(session->query);
1081 /* Skip first table, which is the table we are inserting in */
1082 TableList *second_table= first_table->next_local;
1083 select_lex->table_list.first= (unsigned char*) second_table;
1084
1085=== modified file 'm4/pandora_64bit.m4'
1086--- m4/pandora_64bit.m4 2009-08-04 17:58:31 +0000
1087+++ m4/pandora_64bit.m4 2009-09-14 18:37:34 +0000
1088@@ -23,7 +23,7 @@
1089 AS_IF([test "$isainfo_b" != "x"],[
1090
1091 isainfo_k=`${ISAINFO} -k`
1092- DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_k}"
1093+ DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}"
1094
1095 AS_IF([test "x$ac_enable_64bit" = "xyes"],[
1096