func run()

in Sources/NIOExtrasPerformanceTester/PCAPPerformanceTest.swift [39:64]


    func run() throws -> Int {
        let fileSink = try NIOWritePCAPHandler.SynchronizedFileSink.fileSinkWritingToFile(path: self.outputFile) {
            error in
            print("ERROR: \(error)")
            exit(1)
        }
        defer {
            try! fileSink.syncClose()  // We want this to be included in the timing.
        }

        let channel = EmbeddedChannel()
        defer {
            _ = try! channel.finish()
        }

        let pcapHandler = NIOWritePCAPHandler(mode: .client,
                                              fileSink: fileSink.write)
        try channel.pipeline.addHandler(pcapHandler, position: .first).wait()


        for _ in 0 ..< self.numberOfRepeats {
            channel.writeAndFlush(self.byteBuffer, promise: nil)
            _ = try channel.readOutbound(as: ByteBuffer.self)
        }
        return self.numberOfRepeats
    }