Skip to content

Commit

Permalink
3021 option for time-ordered output from dtrace(1M)
Browse files Browse the repository at this point in the history
3022 DTrace: keys should not affect the sort order when sorting by value
3023 it should be possible to dereference dynamic variables
3024 D integer narrowing needs some work
3025 register leak in D code generation
3026 libdtrace should set LD_NOLAZYLOAD=1 to help the pid provider
Reviewed by: Bryan Cantrill <bmc@joyent.com>
Reviewed by: Eric Schrock <eschrock@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
  • Loading branch information
Adam H. Leventhal committed Jul 25, 2012
1 parent ff50e8e commit e5803b7
Show file tree
Hide file tree
Showing 76 changed files with 2,554 additions and 918 deletions.
6 changes: 4 additions & 2 deletions usr/src/cmd/dtrace/dtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/

#include <sys/types.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -1339,6 +1340,7 @@ main(int argc, char *argv[])

(void) dtrace_setopt(g_dtp, "bufsize", "4m");
(void) dtrace_setopt(g_dtp, "aggsize", "4m");
(void) dtrace_setopt(g_dtp, "temporal", "yes");

/*
* If -G is specified, enable -xlink=dynamic and -xunodefs to permit
Expand Down
3 changes: 3 additions & 0 deletions usr/src/cmd/dtrace/test/cmd/scripts/dtest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#
# Copyright (c) 2011, Joyent, Inc. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
#
require 5.8.4;

Expand Down Expand Up @@ -612,6 +613,8 @@ sub run_tests {
die "$PNAME: failed to open $PNAME.$$.log: $!\n"
unless (!$opt_l || open(LOG, ">$PNAME.$$.log"));

$ENV{'DTRACE_DEBUG_REGSET'} = 'true';

if ($opt_g) {
$ENV{'UMEM_DEBUG'} = 'default,verbose';
$ENV{'UMEM_LOGGING'} = 'fail,contents';
Expand Down
35 changes: 35 additions & 0 deletions usr/src/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/

#pragma D option quiet

/*
* Make sure the sizes of compatible keys doesn't affect the sort order.
*/

BEGIN
{
@[(int)1, 0] = sum(10);
@[(uint64_t)2, 0] = sum(20);
@[(int)3, 0] = sum(30);
@[(uint64_t)4, 0] = sum(40);
printa(@);

exit(0);
}
6 changes: 6 additions & 0 deletions usr/src/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

1 0 10
2 0 20
3 0 30
4 0 40

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The value of i is 6
The value of i is 18
The value of i is 72
The value of i is 25920
The value of i is 935761216
The value of i is -91738734
The value of i is -91738729

50 changes: 50 additions & 0 deletions usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/

/*
* Test compile-time casting between integer types of different size.
*/

#pragma D option quiet

int64_t x;

BEGIN
{
x = (int32_t)(int16_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (int32_t)(uint16_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (uint32_t)(int16_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (uint32_t)(uint16_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
printf("\n");

x = (int16_t)(int32_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (int16_t)(uint32_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (uint16_t)(int32_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);
x = (uint16_t)(uint32_t)0xfff0;
printf("%16x %20d %20u\n", x, x, x);

exit(0);
}
10 changes: 10 additions & 0 deletions usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fffffffffffffff0 -16 18446744073709551600
fff0 65520 65520
fffffff0 4294967280 4294967280
fff0 65520 65520

fffffffffffffff0 -16 18446744073709551600
fffffffffffffff0 -16 18446744073709551600
fff0 65520 65520
fff0 65520 65520

57 changes: 0 additions & 57 deletions usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/

/*
* Test narrowing at assignment.
*/

#pragma D option quiet

uint16_t x;
uint32_t y;

BEGIN
{
x = 0xbeefcafe;
y = x;
printf("%x", y); /* where's the beef? */

exit(0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cafe
52 changes: 52 additions & 0 deletions usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* CDDL HEADER START
*
* 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.
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/

/*
* Test execution-time casting between integer types of different size.
*/

#pragma D option quiet

int64_t x;

BEGIN
{
z = 0xfff0;

x = (int32_t)(int16_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (int32_t)(uint16_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (uint32_t)(int16_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (uint32_t)(uint16_t)z;
printf("%16x %20d %20u\n", x, x, x);
printf("\n");

x = (int16_t)(int32_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (int16_t)(uint32_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (uint16_t)(int32_t)z;
printf("%16x %20d %20u\n", x, x, x);
x = (uint16_t)(uint32_t)z;
printf("%16x %20d %20u\n", x, x, x);

exit(0);
}
10 changes: 10 additions & 0 deletions usr/src/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fffffffffffffff0 -16 18446744073709551600
fff0 65520 65520
fffffff0 4294967280 4294967280
fff0 65520 65520

fffffffffffffff0 -16 18446744073709551600
fffffffffffffff0 -16 18446744073709551600
fff0 65520 65520
fff0 65520 65520

17 changes: 10 additions & 7 deletions usr/src/cmd/dtrace/test/tst/common/buffering/tst.fill1.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,29 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/

/*
* ASSERTION:
* Positive test for fill buffer policy.
*
* SECTION: Buffers and Buffering/fill Policy;
* Buffers and Buffering/Buffer Sizes;
* Buffers and Buffering/Buffer Sizes;
* Options and Tunables/bufsize;
* Options and Tunables/bufpolicy;
* Options and Tunables/statusrate
*/
/*
* This is a brute-force way of testing fill buffers. We assume that each
* printf() stores 8 bytes. Because each fill buffer is per-CPU, we must
* fill up our buffer in one series of enablings on a single CPU.
* This is a brute-force way of testing fill buffers. We assume that
* each printf() stores 16 bytes (4x 32-bit words for EPID, timestamp
* lo, timestamp hi, and the variable i). Because each fill buffer is
* per-CPU, we must fill up our buffer in one series of enablings on a
* single CPU.
*/
#pragma D option bufpolicy=fill
#pragma D option bufsize=64
#pragma D option bufsize=128
#pragma D option statusrate=10ms
#pragma D option quiet

Expand Down
28 changes: 15 additions & 13 deletions usr/src/cmd/dtrace/test/tst/common/buffering/tst.ring3.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/

#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 2012 by Delphix. All rights reserved.
*/

/*
* ASSERTION:
Expand All @@ -37,19 +38,20 @@
*/

/*
* We make some regrettable assumptions about the implementation in this test.
* First, we assume that each entry for the printf() of an int takes _exactly_
* eight bytes (four bytes for the EPID, four bytes for the payload). Second,
* we assume that by allocating storage for n + 1 records, we will get exactly
* n. Here is why: the final predicate that evaluates to false will reserve
* space that it won't use. This act of reservation will advance the wrapped
* offset. That record won't be subsequently used, but the wrapped offset has
* advanced. (And in this case, that old record is clobbered by the exit()
* anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally: we rely on being
* able to run on the CPU that we first ran on.
* We make some regrettable assumptions about the implementation in this
* test. First, we assume that each entry for the printf() of an int
* takes _exactly_ 16 bytes (4 bytes for the EPID, 8 bytes for the
* timestamp, 4 bytes for the payload). Second, we assume that by
* allocating storage for n + 1 records, we will get exactly n. Here is
* why: the final predicate that evaluates to false will reserve space
* that it won't use. This act of reservation will advance the wrapped
* offset. That record won't be subsequently used, but the wrapped
* offset has advanced. (And in this case, that old record is clobbered
* by the exit() anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally:
* we rely on being able to run on the CPU that we first ran on.
*/
#pragma D option bufpolicy=ring
#pragma D option bufsize=40
#pragma D option bufsize=80
#pragma D option quiet

int n;
Expand Down
Loading

0 comments on commit e5803b7

Please sign in to comment.