调整 64位下设置内存大小可能超过4G 问题 新增部分日志

This commit is contained in:
13038267101 2022-11-24 17:18:58 +08:00
parent 2cbd228077
commit 422e79b0b1
3 changed files with 15 additions and 13 deletions

View File

@ -99,10 +99,10 @@ hg_scanner::hg_scanner(ScannerSerial serial
, async_io_(false), is_white_0_(true), isremove_left_hole(false), isremove_right_hole(false), isremove_top_hole(false), isremove_low_hole(false)
, isremove_left_hole_threshold(0), isremove_right_hole_threshold(0), isremove_top_hole_threshold(0), isremove_low_hole_threshold(0)
, dump_usb_path_(""),is_kernelsnap_211209_(false), pid_(0), dump_img_(&hg_scanner::dump_image_empty), is_kernelsnap_220830_(false),is_kernelsnap3288_221106_(false)
, is_kernelsnap_221027_(false), memory_size_(1024), isx86_closeAdvan_(true)
, is_kernelsnap_221027_(false), memory_size_(1024), isx86_Advan_(true)
{
#if !defined(_WIN32) && !defined(_WIN64) &&defined(X86)
isx86_closeAdvan_ = fasle;
#if !defined(_WIN32) && !defined(_WIN64) &&defined(x86_64)
isx86_Advan_ = fasle;
#endif
init_setting_func_map();
final_path_ = hg_log::ini_get("path", "final_img");
@ -117,15 +117,17 @@ hg_scanner::hg_scanner(ScannerSerial serial
dump_img_ = &hg_scanner::dump_image_real;
}
std::string mem = dump_usb_path_ = hg_log::ini_get("mem", "max_img");
std::string mem = hg_log::ini_get("mem", "max_img");
if (!mem.empty())
{
memory_size_ = std::stoi(mem);
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Get the config file --->memory_size_ set is :%lld", memory_size_);
}
std::string adv = dump_usb_path_ = hg_log::ini_get("cpu", "advanced");
std::string adv = hg_log::ini_get("cpu", "advanced");
if (!adv.empty())
{
isx86_closeAdvan_ = adv == "0" ? false : true;
isx86_Advan_ = adv == "0" ? false : true;
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Get the config file --->isx86_Advan_ set is :%d", isx86_Advan_);
}
if (hg_log::create_folder(final_path_.c_str()))
@ -163,7 +165,7 @@ hg_scanner::hg_scanner(ScannerSerial serial
wait_usb_result_.set_debug_info("start");
thread_usb_read_.reset(new std::thread(&hg_scanner::thread_handle_usb, this));
thread_img_handle_.reset(new std::thread(&hg_scanner::thread_image_handle, this));
ImagePrc_pHandle_ = hg_imgproc::init(pid_, isx86_closeAdvan_);;
ImagePrc_pHandle_ = hg_imgproc::init(pid_, isx86_Advan_);;
}
hg_scanner::~hg_scanner()
{
@ -2388,6 +2390,7 @@ int hg_scanner::save_usb_data(std::shared_ptr<tiny_buffer> data)
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
Memoryusae = hg_log::GetAppMemoryUsage();
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "Memory Usage is Too big:%d ,Please wait -_- ...", Memoryusae);
}
imgs_.Put(data);
if (wait_img_.is_waiting())

View File

@ -291,8 +291,8 @@ protected:
unsigned int usb_img_index_;
unsigned int final_img_index_;
std::string final_path_;
unsigned int memory_size_;
bool isx86_closeAdvan_;
unsigned long long memory_size_;
bool isx86_Advan_;
BlockingQueue<std::shared_ptr<tiny_buffer>> imgs_;
void init_settings(const char* json_setting_text);

View File

@ -28,7 +28,7 @@
#include <algorithm>
#include <mutex>
#include "ini_file.h"
#define VMRSS_LINE 22
#define MAX_LOG_FILE_SIZE 100 * 1024 * 1024
#ifdef _INTSIZEOF
#undef _INTSIZEOF
@ -681,8 +681,7 @@ extern "C"
{
log_cls::instance()->log(info);
}
float GetMemoryUsage(int pid)
float GetMemoryUsage(int pid)
{
#ifdef WIN32
uint64_t mem = 0, vmem = 0;
@ -719,7 +718,7 @@ extern "C"
return vmrss / 1024.0;//KB TO MB
#endif
}
float GetAppMemoryUsage()
float GetAppMemoryUsage()
{
return GetMemoryUsage(getpid());
}