Open computerized numerical control (CNC) systems, which are crucial pieces of machinery in discrete manufacturing, are under constant security threat. Trusted computing is considered to be an effective way to protect them. However, the machining process of an open CNC system cannot be protected effectively against control-flow hijacking. Additionally, the performance loss caused by frequent metrics can affect the machining accuracy of the CNC system by heavily occupying CPU computing resources. We provide a novel method called trusted control-flow integrity (TCFI) that selects metric points based on the multi-object particle swarm optimization algorithm(MOPSO) rather than using all the metric points to protect the integrity of an open CNC system during its machining process. TCFI measures particular points in terms of security and metric time to reduce the performance loss of an open CNC system. An appropriate data structure for determining trusted baseline values is designed to minimize performance overhead. We show improved performance by evaluating TCFI on SPEC CPU 2006 and LinuxCNC.The test result shows that TCFI induces a performance loss of around 5% for certain workloads.