Fixed Visual Studio build

Moved affinity to tests
Fixed strange output from mask_to_string
This commit is contained in:
tevador 2019-06-22 23:11:24 +02:00
parent 81d3a9d4a1
commit e8cf27eab5
6 changed files with 20 additions and 12 deletions

View File

@ -57,8 +57,10 @@ $(OBJDIR):
mkdir $(OBJDIR) mkdir $(OBJDIR)
$(BINDIR): $(BINDIR):
mkdir $(BINDIR) mkdir $(BINDIR)
$(OBJDIR)/affinity.o: $(TESTDIR)/affinity.cpp $(TESTDIR)/affinity.hpp
$(CXX) $(CXXFLAGS) -c $< -o $@
$(OBJDIR)/benchmark.o: $(TESTDIR)/benchmark.cpp $(TESTDIR)/stopwatch.hpp \ $(OBJDIR)/benchmark.o: $(TESTDIR)/benchmark.cpp $(TESTDIR)/stopwatch.hpp \
$(TESTDIR)/utility.hpp $(SRCDIR)/randomx.h $(SRCDIR)/blake2/endian.h $(SRCDIR)/affinity.hpp $(TESTDIR)/utility.hpp $(SRCDIR)/randomx.h $(SRCDIR)/blake2/endian.h $(TESTDIR)/affinity.hpp
$(CXX) $(CXXFLAGS) -pthread -c $< -o $@ $(CXX) $(CXXFLAGS) -pthread -c $< -o $@
$(BINDIR)/benchmark: $(OBJDIR)/benchmark.o $(OBJDIR)/affinity.o $(RXA) $(BINDIR)/benchmark: $(OBJDIR)/benchmark.o $(OBJDIR)/affinity.o $(RXA)
$(CXX) $(LDFLAGS) -pthread $< $(OBJDIR)/affinity.o $(RXA) -o $@ $(CXX) $(LDFLAGS) -pthread $< $(OBJDIR)/affinity.o $(RXA) -o $@
@ -109,7 +111,6 @@ $(OBJDIR)/vm_interpreted.o: $(SRCDIR)/vm_interpreted.cpp $(SRCDIR)/vm_interprete
$(SRCDIR)/intrin_portable.h $(SRCDIR)/allocator.hpp $(SRCDIR)/dataset.hpp \ $(SRCDIR)/intrin_portable.h $(SRCDIR)/allocator.hpp $(SRCDIR)/dataset.hpp \
$(SRCDIR)/superscalar_program.hpp $(SRCDIR)/jit_compiler_x86.hpp $(SRCDIR)/reciprocal.h \ $(SRCDIR)/superscalar_program.hpp $(SRCDIR)/jit_compiler_x86.hpp $(SRCDIR)/reciprocal.h \
$(SRCDIR)/instruction_weights.hpp $(SRCDIR)/instruction_weights.hpp
$(OBJDIR/affinity.o: $(SRCDIR)/affinity.cpp $(SRCDIR)/affinity.hpp
$(OBJDIR)/allocator.o: $(SRCDIR)/allocator.cpp $(SRCDIR)/allocator.hpp $(SRCDIR)/intrin_portable.h \ $(OBJDIR)/allocator.o: $(SRCDIR)/allocator.cpp $(SRCDIR)/allocator.hpp $(SRCDIR)/intrin_portable.h \
$(SRCDIR)/virtual_memory.hpp $(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h \ $(SRCDIR)/virtual_memory.hpp $(SRCDIR)/common.hpp $(SRCDIR)/blake2/endian.h \
$(SRCDIR)/configuration.h $(SRCDIR)/randomx.h $(SRCDIR)/configuration.h $(SRCDIR)/randomx.h

View File

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2019, jtgrassie Copyright (c) 2019, jtgrassie
Copyright (c) 2019, tevador <tevador@gmail.com>
All rights reserved. All rights reserved.
@ -26,6 +27,8 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <sstream>
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h> #include <windows.h>
#else #else
@ -95,20 +98,20 @@ cpuid_from_mask(uint64_t mask, const unsigned &thread_index)
std::string std::string
mask_to_string(uint64_t mask) mask_to_string(uint64_t mask)
{ {
std::string r(65, '\0'); std::ostringstream ss;
unsigned len = 0; unsigned len = 0;
unsigned v = 0; unsigned v = 0;
unsigned i = 64; unsigned i = 64;
while (i--) while (i--)
{ {
v = mask >> i; v = mask >> i;
if (1ULL & v) if (1ULL & v)
{ {
if (len == 0) len = i+1; if (len == 0) len = i + 1;
r[len-i] = '1'; ss << '1';
} }
else else
if (len > 0) r[len-i] = '0'; if (len > 0) ss << '0';
} }
return r; return ss.str();
} }

View File

@ -38,7 +38,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "utility.hpp" #include "utility.hpp"
#include "../randomx.h" #include "../randomx.h"
#include "../blake2/endian.h" #include "../blake2/endian.h"
#include "../affinity.hpp" #include "affinity.hpp"
const uint8_t blockTemplate_[] = { const uint8_t blockTemplate_[] = {
0x07, 0x07, 0xf7, 0xa4, 0xf0, 0xd6, 0x05, 0xb3, 0x03, 0x26, 0x08, 0x16, 0xba, 0x3f, 0x10, 0x90, 0x2e, 0x1a, 0x14, 0x07, 0x07, 0xf7, 0xa4, 0xf0, 0xd6, 0x05, 0xb3, 0x03, 0x26, 0x08, 0x16, 0xba, 0x3f, 0x10, 0x90, 0x2e, 0x1a, 0x14,

View File

@ -115,6 +115,7 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\tests\affinity.cpp" />
<ClCompile Include="..\src\tests\benchmark.cpp" /> <ClCompile Include="..\src\tests\benchmark.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -18,6 +18,9 @@
<ClCompile Include="..\src\tests\benchmark.cpp"> <ClCompile Include="..\src\tests\benchmark.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\tests\affinity.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\src\tests\utility.hpp"> <ClInclude Include="..\src\tests\utility.hpp">