Skip to content

Commit

Permalink
Add eventLoopID to NIOEventLoopTickInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzahrmalik committed Jan 9, 2024
1 parent d6fba4c commit 1c86a03
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/NIOPosix/SelectableEventLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 32,15 @@ internal func withAutoReleasePool<T>(_ execute: () throws -> T) rethrows -> T {

/// Information about an EventLoop tick
public struct NIOEventLoopTickInfo {
/// The eventloop which ticked
public var eventLoopID: ObjectIdentifier
/// The number of tasks which were executed in this tick
public var numberOfTasks: Int
/// The time at which the tick began
public var startTime: NIODeadline

internal init(numberOfTasks: Int, startTime: NIODeadline) {
internal init(eventLoopID: ObjectIdentifier, numberOfTasks: Int, startTime: NIODeadline) {
self.eventLoopID = eventLoopID
self.numberOfTasks = numberOfTasks
self.startTime = startTime
}
Expand Down Expand Up @@ -576,7 579,8 @@ Further information:
// Drop everything (but keep the capacity) so we can fill it again on the next iteration.
self.tasksCopy.removeAll(keepingCapacity: true)
}
self.metricsDelegate?.processedTick(info: .init(numberOfTasks: tasksProcessedInTick, startTime: tickStartTime))
let tickInfo = NIOEventLoopTickInfo(eventLoopID: ObjectIdentifier(self), numberOfTasks: tasksProcessedInTick, startTime: tickStartTime)
self.metricsDelegate?.processedTick(info: tickInfo)
}

// This EventLoop was closed so also close the underlying selector.
Expand Down

0 comments on commit 1c86a03

Please sign in to comment.