c
[2025-12-04 17:38:54.990]hc1600a@dbA5100v31# nl80211: Cancel remain-on-channel with cookie 0xd
[2025-12-04 17:38:59.564]nl80211: Cancel remain-on-channel with cookie 0x14
[2025-12-04 17:39:01.511]nl80211: Cancel remain-on-channel with cookie 0x17
[2025-12-04 17:39:01.968]P2P-DEVICE-FOUND c6:8a:96:8c:cc:93 p2p_dev_addr=c6:8a:96:8c:cc:93 pri_dev_type=10-0050F204-5 name='李嘉骏的Redmi K70bbbbbbbbbb' config_methods=0x188 dev_capab=0x25 group_capab=0x0 wfd_dev_info=0x00101c440032 vendor_elems=1 new=1
[2025-12-04 17:39:01.982]PERF-P2]Event: P2P_EVENT_DEVICE_FOUND!
[2025-12-04 17:39:01.982] t=24.028
[2025-12-04 17:39:01.982][hccast]Event: P2P_Ein-on-channel with nl80211: Cancel remain-on-channel with cookie 0x18
[2025-12-04 17:39:02.002]PERF-P2P[INVITATION_RECEIVED]: ifname=p2p0 t=24.044
[2025-12-04 17:39:02.149]info, udhcpd end!
[2025-12-04 17:39:02.149]wlan0: AP-DISABLED
[2025-12-04 17:39:02.149]nl80211: deinit ifname=wlan0 disabled_11b_rates=0
[2025-12-04 17:39:02.163]wlan0: interface state ENABLED->DISABLED
[2025-12-04 17:39:02.163][hccast]hccast_scene_switch: From 0 to 4 , 28153
[2025-12-04 17:39:02.163][hccast]hccast_scene_switch 378 stop scene 0
[2025-12-04 17:39:02.182][hccast]hccast_scene_switch done, 28162
[2025-12-04 17:39:04.386]nl80211: Cancel remain-on-channel with cookie 0x1c
[2025-12-04 17:39:04.408]P2P-GO-NEG-SUCCESS role=client freq=5180 ht40=0 peer_dev=c6:8a:96:8c:cc:93 peer_iface=c6:8a:96:8c:cc:93 wps_method=PBC
[2025-12-04 17:39:04.433]PERF-Pt]EVENT: P2P_EVENT_GO_NEG_SUCCESS!
[2025-12-04 17:39:04.433]6.470
[2025-12-04 17:39:04.434]p2p0: WPS-PBC-ACTIVE
[2025-12-04 17:39:04.434]p2p0: WPS-PBC-ACTIVE ENT_GO_NEG_SUCCESS!
[2025-12-04 17:39:04.817]p2p0: Trying to associate with c6:8a:96:8c:cc:93 (SSID='DIRECT-U6-\xe6\x9d\x8e\xe5\x98\x89\xe9\xaa\x8f\xe7\x9a\x84Redmi K70b' freq=5180 MHz)
[2025-12-04 17:39:04.818][hccast]Event: TRYINGiface:2648 set rwnx_cfg80211_change_iface:2648 set monitor_vif NULL, netdev: p2p0
[2025-12-04 17:39:05.114]p2p0: Associated with c6:8a:96:8c:cc:93
[2025-12-04 17:39:05.115]p2p0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
[2025-12-04 17:39:05.115]rx eapol
[2025-12-04 17:39:05.133]p2p0: CTRL-EVENT-EAP-STARTED EAP authentication started
[2025-12-04 17:39:05.133]rx eapol
[2025-12-04 17:39:05.133]p2p0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=1
[2025-12-04 17:39:05.153]p2p0: CTRL-EVENT-EAP-METHOD EAP vendor 14122 method 1 (WSC) selected
[2025-12-04 17:39:05.231]rx eapol
[2025-12-04 17:39:05.302]rx eapol
[2025-12-04 17:39:05.303][hcos_dsc_mmp_init] fd: 17 mmap size: 32768 is ok
[2025-12-04 17:39:05.303]rx eapol
[2025-12-04 17:39:05.303]rx eapol
[2025-12-04 17:39:05.303]PERF-WPS[M8_RECV]: t=27.360
[2025-12-04 17:39:05.321]p2p0: WPS-CRED-RECEIVED
[2025-12-04 17:39:05.322]PERF-WPS[CRED_RECEIVED]: ifname=p2p0 t=27.366
[2025-12-04 17:39:05.322]p2p0: WPS-SUCCESS
[2025-12-04 17:39:05.322]P2P-GROUP-FORMATION-SUCCESS
[2025-12-04 17:39:05.352]rx eapol
[2025-12-04 17:39:05.352]p2p0: CTRL-EVENT-EAP-FAILURE EAP authentication failed
[2025-12-04 17:39:05.367]p2p0: CTRL-EVENT-DISCONNECTED bssid=c6:8a:96:8c:cc:93 reason=3 locally_generated=1
[2025-12-04 17:39:05.367][hccast]EVENVENT-DSCP-POLICp2p0: CTRL-EVENT-DSCP-POLICY clear_all
[2025-12-04 17:39:05.397]p2p0: Trying to associate with c6:8a:96:8c:cc:93 (SSID='DIRECT-U6-\xe6\x9d\x8e\xe5\x98\x89\xe9\xaa\x8f\xe7\x9a\x84Redmi K70b' freq=5180 MHz)
[2025-12-04 17:39:05.397][hccast]Event: TRYING TO ASSOCIATE!
[2025-12-04 17:39:05.698]p2p0: Associated with c6:8a:96:8c:cc:93
[2025-12-04 17:39:05.698]p2p0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
[2025-12-04 17:39:05.699]rx eapol
[2025-12-04 17:39:05.699]rx eapol
[2025-12-04 17:39:05.713]p2p0: WPA: Key negotiation completed with c6:8a:96:8c:cc:93 [PTK=CCMP GTK=CCMP]
[2025-12-04 17:39:05.730]p2p0: CTRL-EVENT-CONNECTED - Connection to c6:8a:96:8c:cc:93 completed [id=0 id_str=]
[2025-12-04 17:39:05.731]PERF-CONN[CONNECTED]: ifname=p2p0 t=27.774
[2025-12-04 17:39:05.732]P2P-GROUEvent: GROUP STARTED!
[2025-12-04 17:39:05.740]ssid="DIRECT-U6-\xe6\x9d\x8e\xe5\x98\x89\xe9\xaa\x8f\xe7\x9a\x84Redmi K70b" freq=5180 go_dev_addr=c6:8a:96:8c:cc:93 [PERSISTENT]
[2025-12-04 17:39:05.761][hccast]Event: GROUP STARTED!
[2025-12-04 17:39:05.762]info, udhcp clieead][1180] PERSISTENT
[2025-12-04 17:39:05.762]d
[2025-12-04 17:39:05.762]debug, ifindex(5) Sending discover...
[2025-12-04 17:39:05.763]debug, ifindex(5) Sending discover...
[2025-12-04 17:39:05.774]p2p0 no private ioctls.
[2025-12-04 17:39:05.774]
[2025-12-04 17:39:05.784][hccast]pairwise == CCMP
[2025-12-04 17:39:05.797][hccast]p2p_ctrl_nl_th.49.44 obtained, lease time 3599info, Lease of 192.168.49.44 obtained, lease time 3599
[2025-12-04 17:39:05.797][hccast]got peer ip: 192.168.49.1
[2025-12-04 17:39:05.798]info, udhcpc end!
[2025-12-04 17:39:05.915][mira]: wfd_video_formats: 00 01 02 10 00000100 00000000 00000000 00 0000 0000 11 none none
[2025-12-04 17:39:05.962][hccast_mira_callback_func] HCCAST_MIRA_START_DISP [0:0]
[2025-12-04 17:39:06.183][com_logo_dis_backup] backup logo dis.
[2025-12-04 17:39:06.184][hccast]Miracast resolution: 3
[2025-12-04 17:39:06.184]VER:H264(Dec 2 2025 20:05:22)
[2025-12-04 17:39:06.186]allocsz = 0x321b000
[2025-12-04 17:39:06.214]mmz_available = 0x3229e00
[2025-12-04 17:39:06.215][hccast][FEED] V(0:0) A(0:0) P(00000000:00000000) O(0) [TS] 0
[2025-12-04 17:39:06.355]new max urb->actual_length: 706
[2025-12-04 17:39:06.355]new max urb->actual_length: 1458
[2025-12-04 17:39:06.358][miranew max urb->actual_length: 11664
[2025-12-04 17:39:06.380]]x urb->actual_lengCFG 48K
[2025-12-04 17:39:06.380]audio_info.ch_status 0x2000004
[2025-12-04 17:39:06.381]aud_fmt_code 0x1
[2025-12-04 17:39:06.404][hccast_mira_callback_func] HCCAST_MIRA_START_FIRST_FRAME_DISP [0:1]
[2025-12-04 17:39:06.423]win_cast_msg_proc(), line:1357. _ui_screen_change: cast play.
[2025-12-04 17:39:06.424]win_cast_close(), line: 1221!
[2025-12-04 17:39:06.425]win_cast_play_open(): Miracast!
[2025-12-04 17:39:06.435]win_cast_play_wait_open(), m_win_cast_play_open(1):998
[2025-12-04 17:39:08.210][hccast][FEED] V(101:324202) A(184:353280) P(00007d0:000007d0) O(1) [TS] 749692
基于这组 PERF 日志 的精确耗时分析
先按时间线(用 t= 那个相对时间为主)拆一下关键阶段:
-
发现 + 邀请阶段(几乎不耗时)
P2P-DEVICE-FOUND ... new=1PERF-P2P[DEVICE_FOUND]: t = 24.028PERF-P2P[INVITATION_RECEIVED]: t = 24.044
➜ 从发现到收到 Invitation:约 0.016 秒,可以认为没有瓶颈。
-
P2P GO 协商阶段(主要大头)
PERF-P2P[INVITATION_RECEIVED]: t = 24.044P2P-GO-NEG-SUCCESS ...PERF-P2P[GO_NEG_SUCCESS]: t = 26.470(日志里显示6.470,结合前后可推是26.470)
➜ GO 协商耗时 ≈ 26.470 − 24.044 ≈ 2.43 秒
这是"第一次 Miracast 打通"里无线侧最大的时间段。
-
WPS 握手阶段
- WPS EAP/WSC 日志若干
CTRL-EVENT-EAP-STARTED / PROPOSED-METHOD / WSC PERF-WPS[M8_RECV]: t = 27.360
➜ 从GO_NEG_SUCCESS到握手完成(M8):- WPS 耗时 ≈ 27.360 − 26.470 ≈ 0.89 秒
- WPS EAP/WSC 日志若干
-
收到 Credential → 正式 Wi‑Fi 连接完成
PERF-WPS[CRED_RECEIVED]: t = 27.366- 中间一次 WPS 会话的 EAP-Failure + 本端主动断开(协议收尾)
- 重新
Trying to associate ...,用刚下发的 PSK 重新关联 PERF-CONN[CONNECTED]: t = 27.774
➜ Credential → CONNECTED ≈ 27.774 − 27.366 ≈ 0.41 秒
-
DHCP + 首帧
got peer ip: 192.168.49.1在 17:39:05.797(离 CONNECTED 约 0.07 秒)HCCAST_MIRA_START_DISP17:39:05.962HCCAST_MIRA_START_FIRST_FRAME_DISP17:39:06.404
➜ 从 CONNECTED 到首帧:约 0.63 秒
综合结论
- 从 P2P-DEVICE-FOUND 到 CONNECTED 总共约:
( 27.774 − 24.028 ≈ 3.75 ) 秒。 - 这 3.75 秒中,各部分大致是:
- P2P GO 协商:≈ 2.43 秒(占最大头)
- WPS 握手:≈ 0.9 秒
- Credential→CONNECTED + DHCP + 首帧:合计 ~1 秒以内
也就是说,以这次"第一次 Miracast"来看:
- 真正"拖时间"的主要是 P2P GO 协商那一段(INVITATION→GO_NEG_SUCCESS);
- WPS、4 报文握手、DHCP 和图像首帧本身都在比较合理的时间范围内。
后续如果要做优化,核心也还是前面说的那几条:
- 尽量减少多余的
remain-on-channel / listen_only; - 在进入 GO_NEG / PROVISIONING 后立刻停掉
p2p_listen/p2p_find; - 优先 5G 频段,减少在 2.4G 上反复 ROC;
- 充分利用 persistent group,让"第二次起连"直接走 Invitation + PSK,不再跑完整 WPS。
代码里其实已经有"停掉 FIND 的统一出口",我们只要在这里顺便把 LISTEN 也关掉,就能达到你说的效果------一旦进入 GO_NEG / PROVISIONING 流程,立刻把 p2p_find + p2p_listen 一起停掉。
1. 关键点:wpas_p2p_stop_find_oper() 已经在 GO_NEG / 组建时被调用
在 p2p_supplicant.c 里有:
c
static void wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s)
{
wpas_p2p_clear_pending_action_tx(wpa_s);
wpa_s->global->p2p_long_listen = 0;
eloop_cancel_timeout(wpas_p2p_long_listen_delay, wpa_s, NULL);
eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL);
eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
if (wpa_s->global->p2p)
p2p_stop_find(wpa_s->global->p2p);
if (wpa_s->scan_res_handler == wpas_p2p_scan_res_handler) {
wpa_printf(MSG_DEBUG,
"P2P: Do not consider the scan results after stop_find");
wpa_s->scan_res_handler = wpas_p2p_scan_res_ignore_search;
}
}
而在进入 GO_NEG / 建组的流程里,已经有:
c
// 启动 GO 时
P2P_GROUP_ADD/GO 路径中:
wpa_printf(MSG_DEBUG, "P2P: Stop any on-going P2P FIND");
wpas_p2p_stop_find_oper(wpa_s);
// 其它几处也会在开始连接/建组前调用
6884, 7013, 7437, 7687 行附近都有 wpas_p2p_stop_find_oper(wpa_s);
也就是说:一旦进入"开始建组/连接"的路径,就一定会走到 wpas_p2p_stop_find_oper(),这是最佳挂钩点。
2. 在这里顺便停掉 listen(cancel remain-on-channel)
wpas_stop_listen() 已经封装了"取消 ROC + 关 ProbeReq 报告 + 清理 listen_work":
c
static void wpas_stop_listen(void *ctx)
{
struct wpa_supplicant *wpa_s = ctx;
if (wpa_s->off_channel_freq || wpa_s->roc_waiting_drv_freq) {
wpa_drv_cancel_remain_on_channel(wpa_s);
wpa_s->off_channel_freq = 0;
wpa_s->roc_waiting_drv_freq = 0;
}
wpa_drv_set_ap_wps_ie(wpa_s, NULL, NULL, NULL);
if (!wpa_s->p2p_cli_probe)
wpa_drv_probe_req_report(wpa_s, 0);
wpas_p2p_listen_work_done(wpa_s);
}
所以最简单、最干净的实现方式 就是在 wpas_p2p_stop_find_oper() 里加一行调用:
c
static void wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s)
{
wpas_p2p_clear_pending_action_tx(wpa_s);
/* 新增:进入 GO_NEG / PROVISIONING 前,顺带把 listen/ROC 一起停掉 */
wpas_stop_listen(wpa_s);
wpa_s->global->p2p_long_listen = 0;
eloop_cancel_timeout(wpas_p2p_long_listen_delay, wpa_s, NULL);
eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL);
eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
if (wpa_s->global->p2p)
p2p_stop_find(wpa_s->global->p2p);
if (wpa_s->scan_res_handler == wpas_p2p_scan_res_handler) {
...
}
}
这样效果是:
- 在进入 GO_NEG(
wpas_p2p_start_go()/wpas_start_p2p_client()等路径里已经调用wpas_p2p_stop_find_oper()),会同时停止 p2p_find 和 p2p_listen/ROC; - 在进入 PROVISIONING(
group_wpa_s->p2p_in_provisioning = 1;的路径)前也会走 stop_find_oper,同样会自动停掉 listen。
你不需要到处去找 GO_NEG / PROVISIONING 的每一个状态切换点,只要在这个统一入口加上 wpas_stop_listen(wpa_s); 就可以了。
c
[2025-12-04 18:07:02.442]nl80211: Cancel remain-on-channel with cookie 0x3
[2025-12-04 18:07:05.706]nl80211: Cancel remain-on-channel with cookie 0x8
[2025-12-04 18:07:06.365]nl80211: Cancel remain-on-channel with cookie 0x9
[2025-12-04 18:07:10.934]nl80211: Cancel remain-on-channel with cookie 0x10
[2025-12-04 18:07:12.236]nl80211: Cancel remain-on-channel with cookie 0x12
[2025-12-04 18:07:14.759]P2P-DEVICE-FOUND c6:8a:96:8c:cc:93 p2p_dev_addr=c6:8a:96:8c:cc:93 pri_dev_type=10-0050F204-5 name='李嘉骏的Redmi K70bbbbbbbbbb' config_methods=0x188 dev_capab=0x25 group_capab=0x0 wfd_dev_info=0x00101c440032 vendor_elems=1 new=1
[2025-12-04 18:07:14.789]PERF-P2P[Dent: P2P_EVENT_DEVICE_FOUND!
[2025-12-04 18:07:14.790] t=189.517
[2025-12-04 18:07:14.791][hccast]Event: P2P_EVENT_DEVICE_FOUND!
[2025-12-04 18:07:14.849]nl80211: Cancel remain-on-channel with cookie 0x16
[2025-12-04 18:07:14.849]PERF-P2P[INVITATION_RECEIVED]: ifname=p2p0 t=189.588
[2025-12-04 18:07:14.918]info, udhcpd end!
[2025-12-04 18:07:14.919]wlan0: AP-DISABLED
[2025-12-04 18:07:14.921]nl80211: deinit ifname=wlan0 disabled_11b_rates=0
[2025-12-04 18:07:14.932]wlan0: interface state ENABLED->DISABLED
[2025-12-04 18:07:14.932][hccast]hccast_scene_switch: From 0 to 4 , 193620
[2025-12-04 18:07:14.933][hccast]hccast_scene_switch 378 stop scene 0
[2025-12-04 18:07:14.941][hccast]hccast_scene_switch done, 193629
[2025-12-04 18:07:15.538][offchannel_send_action] 373 wait_time = 100
[2025-12-04 18:07:15.539]
[2025-12-04 18:07:15.549]nl80211: Cancel remain-on-channel with cookie 0x18
[2025-12-04 18:07:15.570]P2P-GO-NEG-SUCCESS role=client freq=5180 ht40=0 peer_dev=c6:8a:96:8c:cc:93 peer_iface=c6:8a:96:8c:cc:93 wps_method=PBC
[2025-12-04 18:07:15.601]PERF-P2]EVENT: P2P_EVENT_GO_NEG_SUCCESS!
[2025-12-04 18:07:15.601]90.330
[2025-12-04 18:07:15.602]p2p0: WPS-PBC-ACTIVE
[2025-12-04 18:07:15.603]p2p0: WPS-PBC-ACTIVE ENT_GO_NEG_SUCCESS!
[2025-12-04 18:07:16.201]p2p0: Trying to associate with c6:8a:96:8c:cc:93 (SSID='DIRECT-Pr-\xe6\x9d\x8e\xe5\x98\x89\xe9\xaa\x8f\xe7\x9a\x84Redmi K70b' freq=5180 MHz)
[2025-12-04 18:07:16.202][hccast]Event: TRYge_iface:2648 set rwnx_cfg80211_change_iface:2648 set monitor_vif NULL, netdev: p2p0
[2025-12-04 18:07:16.493]p2p0: Associated with c6:8a:96:8c:cc:93
[2025-12-04 18:07:16.494]p2p0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
[2025-12-04 18:07:16.497]rx eapol
[2025-12-04 18:07:16.511]p2p0: CTRL-EVENT-EAP-STARTED EAP authentication started
[2025-12-04 18:07:16.512]rx eapol
[2025-12-04 18:07:16.513]p2p0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=1
[2025-12-04 18:07:16.520]p2p0: CTRL-EVENT-EAP-METHOD EAP vendor 14122 method 1 (WSC) selected
[2025-12-04 18:07:16.582]new max urb->actual_length: 521
[2025-12-04 18:07:16.583]rx eapol
[2025-12-04 18:07:16.661]rx eapol
[2025-12-04 18:07:16.661][hcos_dsc_mmp_init] fd: 17 mmap size: 32768 is ok
[2025-12-04 18:07:16.663]rx eapol
[2025-12-04 18:07:16.674]rx eapol
[2025-12-04 18:07:16.675]PERF-WPS[M8_RECV]: t=191.416
[2025-12-04 18:07:16.675]p2p0: WPS-CRED-RECEIVED
[2025-12-04 18:07:16.676]PERF-WPS[CRED_RECEIVED]: ifname=p2p0 t=191.421
[2025-12-04 18:07:16.691]p2p0: WPS-SUCCESS
[2025-12-04 18:07:16.692]P2P-GROUP-FORMATION-SUCCESS
[2025-12-04 18:07:16.721]rx eapol
[2025-12-04 18:07:16.723]p2p0: CTRL-EVENT-EAP-FAILURE EAP authentication failed
[2025-12-04 18:07:16.736]p2p0: CTRL-EVENT-DISCONNECTED bssid=c6:8a:96:8c:cc:93 reason=3 locally_generated=1
[2025-12-04 18:07:16.737]p2p0ast]EVENT: DISCONNECT!
[2025-12-04 18:07:16.737]Y clear_all
[2025-12-04 18:07:16.739][hccast]EVENT: DISCONNECT!
[2025-12-04 18:07:16.766]p2p0: Trying to associate with c6:8a:96:8c:cc:93 (SSID='DIRECT-Pr-\xe6\x9d\x8e\xe5\x98\x89\xe9\xaa\x8f\xe7\x9a\x84Redmi K70b' freq=5180 MHz)
[2025-12-04 18:07:16.767][hccast]Event: TRYING TO ASSOCIATE!
[2025-12-04 18:07:17.069]p2p0: Associated with c6:8a:96:8c:cc:93
[2025-12-04 18:07:17.069]p2p0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
[2025-12-04 18:07:17.069]rx eapol
[2025-12-04 18:07:17.071]rx eapol
[2025-12-04 18:07:17.077]p2p0: WPA: Key negotiation completed with c6:8a:96:8c:cc:93 [PTK=CCMP GTK=CCMP]
[2025-12-04 18:07:17.091]p2p0: CTRL-EVENT-CONNECTED - Connection to c6:8a:96:8c:cc:93 completed [id=0 id_str=]
[2025-12-04 18:07:17.091]PERF-CONN[CONNECTED]: ifname=p2p0 t=191.839
[2025-12-04 18:07:17.093]P2P-GROUP-ent: GROUP STARTED!
[2025-12-04 18:07:17.103]ssid="DIRECT-Pr-\xe6\x9d\x8e\xe5\x98\x89\xe9\xaa\x8f\xe7\x9a\x84Redmi K70b" freq=5180 go_dev_addr=c6:8a:96:8c:cc:93 [PERSISTENT]
[2025-12-04 18:07:17.123][hccast]Event: GROUP STARTED!
[2025-12-04 18:07:17.124][p2p_ctrl_nl_lient (v0.9.8-pre) starteinfo, udhcp client (v0.9.8-pre) started
[2025-12-04 18:07:17.124]debug, ifindex(5) Sending discover...
[2025-12-04 18:07:17.144]p2p0 no private ioctls.
[2025-12-04 18:07:17.144]
[2025-12-04 18:07:17.145][hccast]pairwise == CCMP
[2025-12-04 18:07:17.148][hccast]p2p_ctrl_nl_thread 1189: go_or_client: client
[2025-12-04 18:07:17.166]info, Lease of 192.168.49.44 obtained, lease time 3600
[2025-12-04 18:07:17.167][hccast]got peer ip: 192.168.49.1
[2025-12-04 18:07:17.167]info, udhcpc end!
这次日志说明了什么?
先按这次的 PERF 时间轴算一遍(单位=秒,取 t=):
-
发现 + 邀请
PERF-P2P[DEVICE_FOUND]: t = 189.517PERF-P2P[INVITATION_RECEIVED]: t = 189.588
➜ 发现 → 收到邀请:0.071 s(几乎不耗时)
-
P2P GO 协商阶段(已明显变快)
PERF-P2P[GO_NEG_SUCCESS]: t = 190.330(日志里是90.330,结合前后可知应为 190.330)
➜ 邀请 → GO_NEG_SUCCESS:190.330 − 189.588 ≈ 0.74 s
对比优化前的 2.43 s :
P2P GO 协商阶段从 ~2.4 秒降到了 ~0.7 秒,说明我们在 GO_NEG 前后停掉 p2p_listen/p2p_find 的改动已经生效,效果很明显。 -
WPS 握手
PERF-WPS[M8_RECV]: t = 191.416
➜ GO_NEG_SUCCESS → M8:191.416 − 190.330 ≈ 1.09 s(和之前 ~0.9s 同一个量级,正常)
-
收到 Credential → 正式连接完成
PERF-WPS[CRED_RECEIVED]: t = 191.421PERF-CONN[CONNECTED]: t = 191.839
➜ CRED_RECEIVED → CONNECTED:191.839 − 191.421 ≈ 0.42 s
-
DHCP 获取 IP
Lease of 192.168.49.44 obtained ...:18:07:17.166
与CONNECTED(18:07:17.091 左右)只差 ~75 ms,几乎是瞬间。
总结优化效果
- "无线建链部分(从发现到 Wi‑Fi 连接完成)现在约:
(191.839 − 189.517 ≈ 2.32) 秒。
之前同一段是 ~3.75 秒,节省了 约 1.4 秒 ,主要就是来自 P2P GO 协商阶段从 2.4 s 降到 0.7 s。 - WPS、4‑Way 握手、DHCP 都在 1 秒左右或以下,已经很健康;
- 说明"在进入 GO_NEG / PROVISIONING 时统一调用
wpas_p2p_stop_find_oper()+wpas_stop_listen()的做法是有效的,已经把主要的浪费时间段(长时间 listen/ROC)压掉了。