Move Profiler and more cleanup.

This commit is contained in:
XMRig 2020-12-04 09:23:40 +07:00
parent 662a957106
commit c8ee6f7db8
No known key found for this signature in database
GPG key ID: 446A53638BE94409
30 changed files with 123 additions and 256 deletions

View file

@ -1,14 +1,7 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2018-2019 tevador <tevador@gmail.com>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright (c) 2018-2019 tevador <tevador@gmail.com>
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +23,7 @@
#include "base/io/log/Tags.h"
#include "base/kernel/Platform.h"
#include "crypto/common/VirtualMemory.h"
#include "crypto/randomx/randomx.h"
#include "crypto/rx/RxAlgo.h"
#include "crypto/rx/RxCache.h"
@ -162,6 +156,22 @@ size_t xmrig::RxDataset::size(bool cache) const
}
uint8_t *xmrig::RxDataset::tryAllocateScrathpad()
{
auto p = reinterpret_cast<uint8_t *>(raw());
if (!p) {
return nullptr;
}
const size_t offset = m_scratchpadOffset.fetch_add(RANDOMX_SCRATCHPAD_L3_MAX_SIZE);
if (offset + RANDOMX_SCRATCHPAD_L3_MAX_SIZE > m_scratchpadLimit) {
return nullptr;
}
return p + offset;
}
void *xmrig::RxDataset::raw() const
{
return m_dataset ? randomx_get_dataset_memory(m_dataset) : nullptr;
@ -208,19 +218,3 @@ void xmrig::RxDataset::allocate(bool hugePages, bool oneGbPages)
}
# endif
}
uint8_t* xmrig::RxDataset::tryAllocateScrathpad()
{
uint8_t* p = reinterpret_cast<uint8_t*>(raw());
if (!p) {
return nullptr;
}
const size_t offset = m_scratchpadOffset.fetch_add(RANDOMX_SCRATCHPAD_L3_MAX_SIZE);
if (offset + RANDOMX_SCRATCHPAD_L3_MAX_SIZE > m_scratchpadLimit) {
return nullptr;
}
return p + offset;
}