mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
change perror into log
Former-commit-id: b482d6df5aac705fd8b4f6b57ef936678ee40856
This commit is contained in:
parent
87b9405a46
commit
c7f093ce6b
@ -10,6 +10,7 @@ Please mark all change in change log and use the ticket from JIRA.
|
||||
- MS-577 - Unittest Query randomly hung
|
||||
- MS-587 - Count get wrong result after adding vectors and index built immediately
|
||||
- MS-599 - search wrong result when table created with metric_type: IP
|
||||
- MS-601 - Docker logs error caused by get CPUTemperature error
|
||||
|
||||
## Improvement
|
||||
- MS-552 - Add and change the easylogging library
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
|
||||
#include "metrics/SystemInfo.h"
|
||||
#include "utils/Log.h"
|
||||
|
||||
#include <nvml.h>
|
||||
#include <sys/types.h>
|
||||
@ -63,12 +64,12 @@ SystemInfo::Init() {
|
||||
nvmlReturn_t nvmlresult;
|
||||
nvmlresult = nvmlInit();
|
||||
if (NVML_SUCCESS != nvmlresult) {
|
||||
printf("System information initilization failed");
|
||||
SERVER_LOG_ERROR << "System information initilization failed";
|
||||
return;
|
||||
}
|
||||
nvmlresult = nvmlDeviceGetCount(&num_device_);
|
||||
if (NVML_SUCCESS != nvmlresult) {
|
||||
printf("Unable to get devidce number");
|
||||
SERVER_LOG_ERROR << "Unable to get devidce number";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -154,7 +155,7 @@ SystemInfo::getTotalCpuTime(std::vector<uint64_t>& work_time_array) {
|
||||
std::vector<uint64_t> total_time_array;
|
||||
FILE* file = fopen("/proc/stat", "r");
|
||||
if (file == NULL) {
|
||||
perror("Could not open stat file");
|
||||
SERVER_LOG_ERROR << "Could not open stat file";
|
||||
return total_time_array;
|
||||
}
|
||||
|
||||
@ -165,7 +166,7 @@ SystemInfo::getTotalCpuTime(std::vector<uint64_t>& work_time_array) {
|
||||
char buffer[1024];
|
||||
char* ret = fgets(buffer, sizeof(buffer) - 1, file);
|
||||
if (ret == NULL) {
|
||||
perror("Could not read stat file");
|
||||
SERVER_LOG_ERROR << "Could not read stat file";
|
||||
fclose(file);
|
||||
return total_time_array;
|
||||
}
|
||||
@ -245,7 +246,7 @@ SystemInfo::CPUTemperature() {
|
||||
DIR *dir = NULL;
|
||||
dir = opendir(path.c_str());
|
||||
if (!dir) {
|
||||
perror("opendir");
|
||||
SERVER_LOG_ERROR << "Could not open hwmon directory";
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -262,7 +263,7 @@ SystemInfo::CPUTemperature() {
|
||||
object += "/temp1_input";
|
||||
FILE *file = fopen(object.c_str(), "r");
|
||||
if (file == nullptr) {
|
||||
perror("Could not open temperature file");
|
||||
SERVER_LOG_ERROR << "Could not open temperature file"
|
||||
exit(1);
|
||||
}
|
||||
float temp;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user