From: Paul Gofman pgofman@codeweavers.com
--- dlls/nsiproxy.sys/udp.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c index 3cb215c1c58..1db7b3df4eb 100644 --- a/dlls/nsiproxy.sys/udp.c +++ b/dlls/nsiproxy.sys/udp.c @@ -240,7 +240,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void
memset( &key, 0, sizeof(key) ); memset( &stat, 0, sizeof(stat) ); - pid_map = get_pid_map( &pid_map_size ); + if (stat_out) pid_map = get_pid_map( &pid_map_size );
/* skip header line */ ptr = fgets( buf, sizeof(buf), fp ); @@ -254,10 +254,13 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void key.local.Ipv4.sin_addr.WS_s_addr = addr; key.local.Ipv4.sin_port = htons( key.local.Ipv4.sin_port );
- stat.pid = find_owning_pid( pid_map, pid_map_size, inode ); - stat.create_time = 0; /* FIXME */ - stat.flags = 0; /* FIXME */ - stat.mod_info = 0; /* FIXME */ + if (stat_out) + { + stat.pid = find_owning_pid( pid_map, pid_map_size, inode ); + stat.create_time = 0; /* FIXME */ + stat.flags = 0; /* FIXME */ + stat.mod_info = 0; /* FIXME */ + }
if (num < *count) { @@ -290,10 +293,13 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void key.local.Ipv6.sin6_scope_id = find_ipv6_addr_scope( &key.local.Ipv6.sin6_addr, addr_scopes, addr_scopes_size );
- stat.pid = find_owning_pid( pid_map, pid_map_size, inode ); - stat.create_time = 0; /* FIXME */ - stat.flags = 0; /* FIXME */ - stat.mod_info = 0; /* FIXME */ + if (stat_out) + { + stat.pid = find_owning_pid( pid_map, pid_map_size, inode ); + stat.create_time = 0; /* FIXME */ + stat.flags = 0; /* FIXME */ + stat.mod_info = 0; /* FIXME */ + }
if (num < *count) { @@ -344,7 +350,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void if (len <= sizeof(struct xinpgen)) goto err;
addr_scopes = get_ipv6_addr_scope_table( &addr_scopes_size ); - pid_map = get_pid_map( &pid_map_size ); + if (stat_out) pid_map = get_pid_map( &pid_map_size );
orig_xig = (struct xinpgen *)buf; xig = orig_xig; @@ -393,10 +399,13 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void addr_scopes_size ); }
- stat.pid = find_owning_pid( pid_map, pid_map_size, (UINT_PTR)sock->so_pcb ); - stat.create_time = 0; /* FIXME */ - stat.flags = !(in->inp_flags & INP_ANONPORT); - stat.mod_info = 0; /* FIXME */ + if (stat_out) + { + stat.pid = find_owning_pid( pid_map, pid_map_size, (UINT_PTR)sock->so_pcb ); + stat.create_time = 0; /* FIXME */ + stat.flags = !(in->inp_flags & INP_ANONPORT); + stat.mod_info = 0; /* FIXME */ + }
if (num < *count) {
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147476
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: dlls/nsiproxy.sys/udp.c:240 Task: Patch failed to apply
This reduces the time of, e. g, GetUdpStatisticsEx() here from ~10ms to ~0.5ms (because that very costly pid resolution ends being unnecessary used even in udp_num_addrs().
Should in theory help https://bugs.winehq.org/show_bug.cgi?id=51704 (assuming the attribution solely to GetUdpStatisticsEx() function is correct), but I didn't check that with the game.
@gofman It does indeed help with https://bugs.winehq.org/show_bug.cgi?id=51704
I built 2 wine versions to confirm: - unpached master (6cd79a0ea8c7b98b1673c73e68eb1fee0816e0db) - and this PR (416dba0da712fb0066219f6646aff5c200698e6c)
There is a clear improvement. You can see the frame-time graphs and the corresponding logs with `WINEDEBUG=+pid,+loaddll,+timestamp,+seh,+unwind,+debugstr,+iphlpapi,+nsi` below.
![unpatched](/uploads/52b5f773273823ba6c4e2c2f7048c2a3/unpatched.jpg)
![patched](/uploads/c876ba925c88701a7080b5993d38b3fd/patched.jpg)
[unpatched.log](/uploads/2c2b7b212f223bb2e165c23d7f794280/unpatched.log)
[patched.log](/uploads/5ceb2828921bf69ef3f7b791d564247b/patched.log)
This merge request was approved by Huw Davies.