You can use the CMachine. GetNCStatus() and check for NCStatusEnum.Run while machine is in Auto mode and use the CycleComplete to check for end of cycle or cycle time. The time interval between the 2 is the cycle time that completes the part program without error.