| 83 | } |
| 84 | |
| 85 | static void initMaxValueFile(const std::string& filename = "max_values.json") { |
| 86 | std::lock_guard<std::mutex> lock(maxValueFileMutex); |
| 87 | |
| 88 | if (maxValueFile.is_open()) { |
| 89 | maxValueFile.close(); |
| 90 | } |
| 91 | |
| 92 | currentMaxValueFile = filename; |
| 93 | maxValueFile.open(filename, std::ios::out); |
| 94 | if (maxValueFile.is_open()) { |
| 95 | maxValueFile << "{\n"; |
| 96 | maxValueFile.flush(); |
| 97 | isFirstMaxValue = true; |
| 98 | MNN_PRINT("Initialized max value file: %s\n", filename.c_str()); |
| 99 | } else { |
| 100 | MNN_ERROR("Failed to open max value file: %s\n", filename.c_str()); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | static void writeMaxValueRealtime(const std::string& opName, float maxValueFloat) { |
| 105 | std::lock_guard<std::mutex> lock(maxValueFileMutex); |
no test coverage detected