Forum Replies Created
-
AuthorPosts
-
March 25, 2025 at 7:39 am in reply to: In the case of c# (NdisApiDemo), the CPU usage is high when the program is compi #14002
Thank you
March 18, 2025 at 8:48 am in reply to: In the case of c# (NdisApiDemo), the CPU usage is high when the program is compi #14000March 18, 2025 at 8:45 am in reply to: In the case of c# (NdisApiDemo), the CPU usage is high when the program is compi #13999With your team’s technical guidance, my C# application integrating your driver has successfully reduced CPU utilization and is running stably. However, under the current operational parameters (20Mbps uplink/30Mbps downlink), the CPU utilization rate remains between 5%-10%. Are there any additional optimization methods to further reduce the software’s CPU resource consumption?
March 5, 2025 at 3:24 pm in reply to: In the case of c# (NdisApiDemo), the CPU usage is high when the program is compi #13975Thank you
if (eventIndex >= 0 && eventIndex < waitHandlesManualResetEvents.Count) { waitHandlesManualResetEvents[eventIndex].Reset(); }
waitHandlesManualResetEvents[eventIndex]
Array index out of bounds
此处代码会出现数组索引越界
March 5, 2025 at 10:29 am in reply to: In the case of c# (NdisApiDemo), the CPU usage is high when the program is compi #13973private static unsafe void PassThruUnsortedThread
(
NdisApi filter,
WaitHandle[] waitHandles,
IReadOnlyList<AutoResetEvent> waitHandlesManualResetEvents)
{
const int bufferSize = 32;var buffers = new IntPtr[bufferSize];
for (int i = 0; i < buffers.Length; i++)
{
buffers[i] = (IntPtr)filter.CreateIntermediateBuffer();
}while (true)
{
WaitHandle.WaitAny(waitHandles);
uint packetsSuccess = 0;while (filter.ReadPacketsUnsorted(buffers, bufferSize, ref packetsSuccess))
{
for (int i = 0; i < packetsSuccess; i++)
{
EthernetPacket ethPacket = buffers[i].GetEthernetPacket(filter);
if (ethPacket.PayloadPacket is IPv4Packet iPv4Packet)
{
if (iPv4Packet.PayloadPacket is TcpPacket tcpPacket)
{
//Console.WriteLine($”{iPv4Packet.SourceAddress}:{tcpPacket.SourcePort} -> {iPv4Packet.DestinationAddress}:{tcpPacket.DestinationPort}.”);
}
}
}if (packetsSuccess > 0)
{
filter.SendPacketsUnsorted(buffers, packetsSuccess, out uint numPacketsSuccess);
}
}
}
}
}The demo has high CPU usage
c# 调用驱动的时候,16核心cpu 占用16%
-
AuthorPosts