Skip to content

Commit

Permalink
[CI] Fix python lint (#2925)
Browse files Browse the repository at this point in the history
# Motivation

Fix the python lint check.

# Modification

This PR fixes all the warnings related to the new python lint check.

# Result

Only green CI.
  • Loading branch information
FranzBusch authored Oct 17, 2024
1 parent efe445d commit 290b349
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mallocCountTotal" : 8000
}
3 changes: 3 additions & 0 deletions Benchmarks/Thresholds/6.0/NIOPosixBenchmarks.TCPEcho.p90.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mallocCountTotal" : 548
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"mallocCountTotal" : 164376
}
30 changes: 18 additions & 12 deletions dev/stackdiff-dtrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@
##
##===----------------------------------------------------------------------===##

import sys
import re
import collections
import re
import sys

num_regex = "^ +([0-9]+)$"


def put_in_dict(path):
# Our input looks something like:
#
# =====
# This will collect stack shots of allocations and print it when you exit dtrace.
# So go ahead, run your tests and then press Ctrl+C in this window to see the aggregated result
# So go ahead, run your tests and then press Ctrl+C in this window to see the aggregated result # noqa: E501
# =====
# DEBUG: After waiting 1 times, we quiesced to unfreeds=744
# test_1_reqs_1000_conn.total_allocations: 490000
Expand All @@ -39,11 +40,11 @@ def put_in_dict(path):
# libswiftCore.dylib`swift_allocObject+0x27
# test_1_reqs_1000_conn`closure #3 in SelectableEventLoop.run()+0x166
# test_1_reqs_1000_conn`SelectableEventLoop.run()+0x234
# test_1_reqs_1000_conn`closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:selectorFactory:initializer:)+0x12e
# test_1_reqs_1000_conn`partial apply for closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:selectorFactory:initializer:)+0x25
# test_1_reqs_1000_conn`thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) -> ()+0xf
# test_1_reqs_1000_conn`partial apply for thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) -> ()+0x11
# test_1_reqs_1000_conn`closure #1 in static ThreadOpsPosix.run(handle:args:detachThread:)+0x1c9
# test_1_reqs_1000_conn`closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:selectorFactory:initializer:)+0x12e # noqa: E501
# test_1_reqs_1000_conn`partial apply for closure #1 in static MultiThreadedEventLoopGroup.setupThreadAndEventLoop(name:selectorFactory:initializer:)+0x25 # noqa: E501
# test_1_reqs_1000_conn`thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) -> ()+0xf # noqa: E501
# test_1_reqs_1000_conn`partial apply for thunk for @escaping @callee_guaranteed (@guaranteed NIOThread) -> ()+0x11 # noqa: E501
# test_1_reqs_1000_conn`closure #1 in static ThreadOpsPosix.run(handle:args:detachThread:)+0x1c9 # noqa: E501
# libsystem_pthread.dylib`_pthread_start+0xe0
# libsystem_pthread.dylib`thread_start+0xf
# 85945
Expand Down Expand Up @@ -71,7 +72,7 @@ def put_in_dict(path):
key = "\n".join(line.split("+")[0] for line in current_stack[:8])

# Record this stack and reset our state to build a new one.
dictionary[key].append( (int(line), "\n".join(current_stack)) )
dictionary[key].append((int(line), "\n".join(current_stack)))
current_stack = []
else:
# This line doesn't contain just a number. This might be an
Expand All @@ -82,30 +83,35 @@ def put_in_dict(path):

return dictionary


def total_count_for_key(d, key):
value = d[key]
return sum(map(lambda x : x[0], value))
return sum(map(lambda x: x[0], value))


def total_for_dictionary(d):
total = 0
for k in d.keys():
total += total_count_for_key(d, k)
return total


def extract_useful_keys(d):
keys = set()
for k in d.keys():
if total_count_for_key(d, k) >= 1000:
keys.add(k)
return keys


def print_dictionary_member(d, key):
print(total_count_for_key(d, key))
print(key)
print()
print_dictionary_member_detail(d, key)
print()


def print_dictionary_member_detail(d, key):
value = d[key]
for (count, stack) in value:
Expand All @@ -128,6 +134,7 @@ def usage():
print(" # diff them")
print(" stackdiff-dtrace.py /tmp/old /tmp/new")


if len(sys.argv) != 3:
usage()
sys.exit(1)
Expand Down Expand Up @@ -173,5 +180,4 @@ def usage():

everything_before = total_for_dictionary(before_dict)
everything_after = total_for_dictionary(after_dict)
print("Total of _EVERYTHING_ BEFORE: %d, AFTER: %d, DIFFERENCE: %d" %
(everything_before, everything_after, everything_after - everything_before))
print("Total of _EVERYTHING_ BEFORE: %d, AFTER: %d, DIFFERENCE: %d" % (everything_before, everything_after, everything_after - everything_before)) # noqa: E501

0 comments on commit 290b349

Please sign in to comment.