## 4 Performance Analysis
### Tfr  
The TFR failure recovery time, \(D_{TFR}\) can be approximated as follows:  
\[D_{TFR}=D_{DT}+D_{BMC}, \tag{5}\]  
where \(D_{DT}\) refers to the detection and recovery delay and \(D_{BMC}\) refers to the BMC algorithm reestablishment delay.  
The BMC reestablishment delay, \(D_{BMC}\), refers to the amount of time required to reestablish the BMC algorithm in the PTP nodes when a failure occurs in the network; therefore, \(D_{BMC}\) can be determined as follows:  
\[D_{BMC}=N_{Recovery}\times\sum_{j=1}^{C_{BMC}}(O_{CK}+O_{MCE}), \tag{6}\]  
Figure 7: A sample PTP network with possible link failures.  
where \(j\) represents the number of clocks that will be involved in the recovery operation, \(N_{Recovery}\) refers to the total number of clocks that will be involved in the recovery operations and \(C_{BMC}\) refers to the number of clocks that are involved in BMC reestablishment. \(O_{CK}\) refers to the port identification operation and \(O_{MCE}\) refers to the MCs compassion and election operation. Specifically, \(O_{CK}\) refers to the amount of time required to identify all the ports in the network segment by each node that will be involved in the recovery operation; then, \(O_{CK}\) is determine as follows:  
\[O_{CK}=N_{Ports}\times\frac{I_{Port}}{PC_{R}}, \tag{7}\]  
where \(I_{Port}\) refers to the ports state identifier and \(PC_{R}\) refers to node processing rate. Furthermore, \(O_{MCE}\) refers to the amount of time required to compare all the MCs in the network segment and to elect the best master from among them. Therefore, it can be determined as follows:  
\[O_{MCE}=N_{MC}\times\frac{2\times MC_{DS}}{PC_{R}}, \tag{8}\]  
where \(N_{MC}\) refers to the total number of MCs in the network segment and \(MC_{DS}\) refers to the MC dataset that identifies the timing accuracy of each node.  
The TFR fault detection delay refers to the time duration that the node consumes when failure is detected, which can be determined as follows:  
For the best-case detection scenario:  
\[D_{DT(TFR-Best)}=3\times S_{INT}. \tag{9}\]  
For the worst-case detection scenario:  
\[D_{DT(TFR-Worst)}=2\times(3\times S_{INT})+2\times(3\times A_{INT}), \tag{10}\]  
where \(S_{INT}\) refers to the Sync-Interval and \(A_{INT}\) refers to the Announce-Interval.  
Considering these delays, the total delay of TFR approach (\(D_{TFR}\)) with the best-case detection scenario is determined as follows:  
\[D_{TFR(Best-Case)}= 3\times S_{INT}+N_{Recovery}\times\sum_{j=1}^{C_{BMC}}\left(N_{ Ports}\times\frac{I_{Port}}{PC_{R}}+N_{MC}\times\frac{2\times MC_{DS}}{PC_{R}} \right). \tag{11}\]  
The TFR for the worst-case detection scenario, \(D_{TFR}\) is determined as follows:  
\[D_{TFR(Worst-Case)}= 2\times(3\times S_{INT})+2\times(3\times A_{INT}) \tag{12}\] \[+N_{Recovery}\times\sum_{j=1}^{C_{BMC}}\left(N_{Ports}\times \frac{I_{Port}}{PC_{R}}+N_{MC}\times\frac{2\times MC_{DS}}{PC_{R}}\right).\]  
For the sample PTP network shown in Figure 2, the TFR delays with 20 link failures are:  
\[D_{TFR(Best-Case,20\text{ links failure})} =3\times 0.0078+20\times\sum_{i=1}^{40}\left(22\times\frac{10\times 8 }{10^{8}}+2\times\frac{2\times 14\times 8}{10^{8}}\right) \tag{13}\] \[=0.0411\,\text{(s)}\] \[D_{TFR(Worst-Case,20\text{ links failure})} =6\times 0.0078+6\times 0.125+20\times\sum_{i=1}^{40}\left(22 \times\frac{10\times 8}{10^{8}}+2\times\frac{2\times 14\times 8}{10^{8}}\right)\] (14) \[=0.8145\,\text{(s)}\]Table 1 shows the total delay duration for detecting and recovering the failure occurrence for the sample network. The results show that the delay duration in the TFR best-case detection scenario ranges between 0.0234 and 0.0411 s, the delay duration for the TFR worst-case detection scenario ranges between 0.7969 and 0.8145 s, and the delay duration for the PTP under RSTP is 4 s.