Add function to write critical path to disk.