Author: markj
Date: Fri Aug 26 20:51:09 2016
New Revision: 304861
URL: https://svnweb.freebsd.org/changeset/base/304861

Log:
  7297 clear() on llquantize aggregation causes dtrace to exit
  7298 printa() of multiple aggregations can fail for llquantize()
  
  illumos/illumos-gate@0ddc0ebb74cedb0ac394818c6e166c47eb8e62e5
  
  Reviewed by: Patrick Mooney <patrick.moo...@joyent.com>
  Reviewed by: Robert Mustacchi <r...@joyent.com>
  Reviewed by: Dan McDonald <dan...@omniti.com>
  Reviewed by: Adam Leventhal <adam.levent...@gmail.com>
  Approved by: Richard Lowe <richl...@richlowe.net>
  Author: Bryan Cantrill <br...@joyent.com>

Added:
  vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d
  vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d.out
  vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d
  vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d.out
Modified:
  vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d       
Fri Aug 26 20:51:09 2016        (r304861)
@@ -0,0 +1,23 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+       @ = llquantize(0, 10, 0, 6, 20);
+       clear(@);
+       exit(0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d.out
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.clear.d.out   
Fri Aug 26 20:51:09 2016        (r304861)
@@ -0,0 +1,6 @@
+
+
+           value  ------------- Distribution ------------- count    
+             < 1 |                                         0        
+               1 |                                         0        
+

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d   
Fri Aug 26 20:51:09 2016        (r304861)
@@ -0,0 +1,24 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+       @sfo["tabs"] = llquantize(10000, 10, 0, 6, 20);
+       @yvr["spaces"] = count();
+       printa(@sfo, @yvr);
+       exit(0);
+}

Added: 
vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d.out
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
vendor/illumos/dist/cmd/dtrace/test/tst/common/llquantize/tst.multiaggs.d.out   
    Fri Aug 26 20:51:09 2016        (r304861)
@@ -0,0 +1,13 @@
+
+  spaces                                            
+           value  ------------- Distribution ------------- count    
+             < 1 |                                         0        
+               1 |                                         0        
+                1
+  tabs                                              
+           value  ------------- Distribution ------------- count    
+            9500 |                                         0        
+           10000 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+           15000 |                                         0        
+                0
+

Modified: vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c
==============================================================================
--- vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c     Fri Aug 26 
20:23:10 2016        (r304860)
+++ vendor/illumos/dist/lib/libdtrace/common/dt_aggregate.c     Fri Aug 26 
20:51:09 2016        (r304861)
@@ -25,7 +25,7 @@
  */
 
 /*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
@@ -1145,7 +1145,13 @@ dt_aggwalk_rval(dtrace_hdl_t *dtp, dt_ah
                size = rec->dtrd_size;
                data = &h->dtahe_data;
 
-               if (rec->dtrd_action == DTRACEAGG_LQUANTIZE) {
+               if (rec->dtrd_action == DTRACEAGG_LQUANTIZE ||
+                   rec->dtrd_action == DTRACEAGG_LLQUANTIZE) {
+                       /*
+                        * For lquantize() and llquantize(), we want to be
+                        * sure to not zero the aggregation parameters; step
+                        * over them and adjust our size accordingly.
+                        */
                        offs = sizeof (uint64_t);
                        size -= sizeof (uint64_t);
                }
@@ -1894,12 +1900,13 @@ dtrace_aggregate_walk_joined(dtrace_hdl_
                rec = &aggdesc->dtagd_rec[aggdesc->dtagd_nrecs - 1];
 
                /*
-                * Now for the more complicated part.  If (and only if) this
-                * is an lquantize() aggregating action, zero-filled data is
-                * not equivalent to an empty record:  we must also get the
-                * parameters for the lquantize().
+                * Now for the more complicated part.  For the lquantize() and
+                * llquantize() aggregating actions, zero-filled data is not
+                * equivalent to an empty record:  we must also get the
+                * parameters for the lquantize()/llquantize().
                 */
-               if (rec->dtrd_action == DTRACEAGG_LQUANTIZE) {
+               if (rec->dtrd_action == DTRACEAGG_LQUANTIZE ||
+                   rec->dtrd_action == DTRACEAGG_LLQUANTIZE) {
                        if (aggdata->dtada_data != NULL) {
                                /*
                                 * The easier case here is if we actually have
@@ -1920,7 +1927,7 @@ dtrace_aggregate_walk_joined(dtrace_hdl_
                                 * -- either directly or indirectly.) So as
                                 * gross as it is, we'll grovel around in the
                                 * compiler-generated information to find the
-                                * lquantize() parameters.
+                                * lquantize()/llquantize() parameters.
                                 */
                                dtrace_stmtdesc_t *sdp;
                                dt_ident_t *aid;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to