usr/src/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d
author Adam H. Leventhal <ahl@delphix.com>
Wed, 25 Jul 2012 19:05:31 -0400
changeset 13758 23432da34147
permissions -rw-r--r--
3021 option for time-ordered output from dtrace(1M) 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 <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Approved by: Garrett D'Amore <[email protected]>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13758
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     1
/*
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     2
 * CDDL HEADER START
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     3
 *
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     4
 * This file and its contents are supplied under the terms of the
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     5
 * Common Development and Distribution License ("CDDL"), version 1.0.
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     6
 * You may only use this file in accordance with the terms of version
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     7
 * 1.0 of the CDDL.
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     8
 *
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
     9
 * A full copy of the text of the CDDL should have accompanied this
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    10
 * source.  A copy of the CDDL is also available via the Internet at
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    11
 * http://www.illumos.org/license/CDDL.
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    12
 *
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    13
 * CDDL HEADER END
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    14
 */
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    15
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    16
/*
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    17
 * Copyright (c) 2012 by Delphix. All rights reserved.
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    18
 */
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    19
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    20
/*
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    21
 * This test excercises the "remnant" handling of the temporal option.
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    22
 * At the end of one pass of retrieving and printing data from all CPUs,
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    23
 * some unprocessed data will remain, because its timestamp is after the
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    24
 * time covered by all CPUs' buffers.  This unprocessed data is
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    25
 * rearranged in a more space-efficient manner.  If this is done
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    26
 * incorrectly, an alignment error may occur.  To test this, we use a
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    27
 * high-frequency probe so that data will be recorded in subsequent
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    28
 * CPU's buffers after the first CPU's buffer is obtained.  The
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    29
 * combination of data traced here (a 8-byte value and a 4-byte value)
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    30
 * is effective to cause alignment problems with an incorrect
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    31
 * implementation.
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    32
 *
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    33
 * This test needs to be run on a multi-CPU system to be effective.
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    34
 */
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    35
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    36
#pragma D option quiet
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    37
#pragma D option temporal
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    38
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    39
profile-4997
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    40
{
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    41
	printf("%u %u", 1ULL, 2);
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    42
}
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    43
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    44
tick-1
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    45
/i++ == 10/
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    46
{
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    47
	exit(0);
23432da34147 3021 option for time-ordered output from dtrace(1M)
Adam H. Leventhal <ahl@delphix.com>
parents:
diff changeset
    48
}