milvus/cpp/src/utils/CommonUtil.h
starlord 54b85185fe refine error code
Former-commit-id: 2919dc7e39aa970522bd99d553bd0f92fcee9345
2019-09-06 16:16:44 +08:00

43 lines
1.3 KiB
C++
Executable File

/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#pragma once
#include <string>
#include <time.h>
#include "Error.h"
namespace zilliz {
namespace milvus {
namespace server {
class CommonUtil {
public:
static bool GetSystemMemInfo(unsigned long &total_mem, unsigned long &free_mem);
static bool GetSystemAvailableThreads(unsigned int &thread_count);
static bool IsFileExist(const std::string &path);
static uint64_t GetFileSize(const std::string &path);
static bool IsDirectoryExist(const std::string &path);
static ErrorCode CreateDirectory(const std::string &path);
static ErrorCode DeleteDirectory(const std::string &path);
static std::string GetExePath();
static bool TimeStrToTime(const std::string& time_str,
time_t &time_integer,
tm &time_struct,
const std::string& format = "%d-%d-%d %d:%d:%d");
static void ConvertTime(time_t time_integer, tm &time_struct);
static void ConvertTime(tm time_struct, time_t &time_integer);
};
}
}
}