Skip to content

Commit

Permalink
Removed redundant code
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Hoang <ianhoang16@gmail.com>
  • Loading branch information
IanHoang committed Dec 11, 2024
1 parent 7268568 commit 823f14d
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions osbenchmark/worker_coordinator/worker_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,8 @@ async def __call__(self, *args, **kwargs):
yappi.stop()
s = python_io.StringIO()

stats = yappi.get_func_stats()

if self.sort_type:
if self.sort_type not in self.SORT_TYPES:
raise exceptions.SystemSetupError(
Expand All @@ -1585,28 +1587,17 @@ async def __call__(self, *args, **kwargs):
)

self.logger.info("Using Async Profiler with sort type: %s", self.sort_type)
# Return stats in desc order for ncalls
stats = yappi.get_func_stats()
stats.sort(sort_type=self.sort_type, sort_order='desc')

# Print all results
stats.print_all(out=s, columns={
0: ("name", 140),
1: ("ncall", 8),
2: ("tsub", 8),
3: ("ttot", 8),
4: ("tavg", 8)
}
)
else:
self.logger.info("Using Async Profiler")
yappi.get_func_stats().print_all(out=s, columns={
0: ("name", 140),
1: ("ncall", 8),
2: ("tsub", 8),
3: ("ttot", 8),
4: ("tavg", 8)
})
self.logger.info("Using Async Profiler without sort type")

stats.print_all(out=s, columns={
0: ("name", 140),
1: ("ncall", 8),
2: ("tsub", 8),
3: ("ttot", 8),
4: ("tavg", 8)
})


profile = f"\n=== Profile start for client id [{self.client_id}] and task [{self.task}] ===\n"
Expand Down

0 comments on commit 823f14d

Please sign in to comment.