Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions dev/boxed-existentials.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/sbin/dtrace -q -s
/*===----------------------------------------------------------------------===*
*
* This source file is part of the SwiftNIO open source project
*
* Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
* Licensed under Apache License v2.0
*
* See LICENSE.txt for license information
* See CONTRIBUTORS.txt for the list of SwiftNIO project authors
*
* SPDX-License-Identifier: Apache-2.0
*
*===----------------------------------------------------------------------===*/

/*
* example invocation:
* sudo dev/boxed-existentials.d -c .build/release/NIOHTTP1Server
*/

pid$target::__swift_allocate_boxed_opaque_existential*:entry {
ustack();
}
37 changes: 37 additions & 0 deletions dev/malloc-aggregation.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/sbin/dtrace -q -s
/*===----------------------------------------------------------------------===*
*
* This source file is part of the SwiftNIO open source project
*
* Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
* Licensed under Apache License v2.0
*
* See LICENSE.txt for license information
* See CONTRIBUTORS.txt for the list of SwiftNIO project authors
*
* SPDX-License-Identifier: Apache-2.0
*
*===----------------------------------------------------------------------===*/

/*
* example invocation:
* sudo dev/malloc-aggregation.d -c .build/release/NIOHTTP1Server
*/

::BEGIN {
printf("\n\n");
printf("=====\n");
printf("This will collect stack shots of allocations and print it when ");
printf("you exit dtrace.\n");
printf("So go ahead, run your tests and then press Ctrl+C in this window ");
printf("to see the aggregated result\n");
printf("=====\n");
}

pid$target::malloc:entry {
@malloc_calls[ustack()] = count();
}

::END {
printa(@malloc_calls);
}
21 changes: 20 additions & 1 deletion scripts/sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi
printf "=> Checking license headers... "
tmp=$(mktemp /tmp/.swift-nio-sanity_XXXXXX)

for language in swift-or-c bash; do
for language in swift-or-c bash dtrace; do
declare -a matching_files
declare -a exceptions
expections=( )
Expand Down Expand Up @@ -73,6 +73,25 @@ EOF
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##
EOF
;;
dtrace)
matching_files=( -name '*.d' )
cat > "$tmp" <<"EOF"
#!/usr/sbin/dtrace -q -s
/*===----------------------------------------------------------------------===*
*
* This source file is part of the SwiftNIO open source project
*
* Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
* Licensed under Apache License v2.0
*
* See LICENSE.txt for license information
* See CONTRIBUTORS.txt for the list of SwiftNIO project authors
*
* SPDX-License-Identifier: Apache-2.0
*
*===----------------------------------------------------------------------===*/
EOF
;;
*)
Expand Down