diff --git a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
index e1634be3a84b27de82eacc437473c9024cf878c7..02d1747328b65f30a20b2db2eecdb0f06f711bdf 100644
--- a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
+++ b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/hpvm-rt-controller.cpp
@@ -273,10 +273,12 @@ double ProfileInfo::getCurrentIterationComputeEnergy() {
 void ProfileInfo::set_out_file_name(std::string &str) { out_file_name = str; }
 
 void ProfileInfo::printToFile() {
-
   INFO("Writing Runtime Profile Info File...\n");
-  std::ofstream s_out(out_file_name.c_str());
 
+  if (control_time_info.size() == 0)
+    return;
+
+  std::ofstream s_out(out_file_name.c_str());
   if (!s_out) {
     ERROR("Failed to open output file.");
     abort();