| 102 | } |
| 103 | |
| 104 | static void writeMaxValueRealtime(const std::string& opName, float maxValueFloat) { |
| 105 | std::lock_guard<std::mutex> lock(maxValueFileMutex); |
| 106 | |
| 107 | if (!maxValueFile.is_open()) { |
| 108 | initMaxValueFile(currentMaxValueFile); |
| 109 | } |
| 110 | |
| 111 | if (maxValueFile.is_open()) { |
| 112 | if (!isFirstMaxValue) { |
| 113 | maxValueFile << ",\n"; |
| 114 | } |
| 115 | |
| 116 | maxValueFile << " \"" << opName << "\": " << maxValueFloat; |
| 117 | maxValueFile.flush(); |
| 118 | isFirstMaxValue = false; |
| 119 | |
| 120 | MNN_PRINT("Saved max value: %s = %f\n", opName.c_str(), maxValueFloat); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | static void cleanupAtExit() { |
| 125 | closeThresholdFile(); |
no test coverage detected