Compare commits

...

224 Commits

Author SHA1 Message Date
xmrig
5a2cf85b6c Update CHANGELOG.md 2019-01-23 19:44:14 +07:00
xmrig
80de5766ac Update CHANGELOG.md 2019-01-23 19:39:55 +07:00
XMRig
2c0183dcef v2.10.0 2019-01-23 19:31:45 +07:00
XMRig
8a90fc699e Merge branch 'dev' 2019-01-23 19:29:54 +07:00
XMRig
b1816005fd Sync changes with proxy. 2019-01-21 19:16:49 +07:00
XMRig
f478fa843d Better fix for memory allocation, thanks @SChernykh. 2019-01-21 17:27:45 +07:00
XMRig
046c345f65 Fix memory allocation. 2019-01-21 01:44:15 +07:00
XMRig
9692f92c6b New default value for max-cpu-usage option is 100 (instead of 75) also this option now deprecated. 2019-01-21 00:37:36 +07:00
XMRig
bc26d2ede6 #904 Add ASM implementation. 2019-01-21 00:32:24 +07:00
XMRig
36b01f136f #904 Initial support for "cn-pico/trtl". 2019-01-20 19:52:44 +07:00
XMRig
ca43d155d8 v2.9.5-dev 2019-01-20 15:13:01 +07:00
XMRig
e04d0f504c Merge branch 'master' into dev 2019-01-20 15:12:26 +07:00
XMRig
acca8f79cf v2.9.4 2019-01-19 23:55:30 +07:00
XMRig
2c38f693d7 Merge branch 'dev' 2019-01-19 23:54:50 +07:00
xmrig
4faa95b460 Update CHANGELOG.md 2019-01-19 23:53:39 +07:00
xmrig
5f9ebdf149 Merge pull request #915 from SChernykh/dev
Make JIT memory read-only after patching is done
2019-01-19 17:55:54 +07:00
SChernykh
31a571dc70 Make JIT memory read-only after patching is done 2019-01-19 11:22:54 +01:00
XMRig
897ff83dcd #913 Increase max blob size for MSR secor upgrade. 2019-01-18 21:44:44 +07:00
XMRig
a63794ccd6 v2.9.4-dev 2019-01-17 20:43:25 +07:00
XMRig
b15e605614 Merge branch 'master' into dev 2019-01-17 20:41:52 +07:00
XMRig
18335392a1 Merge branch 'master' of github.com:xmrig/xmrig 2019-01-17 12:22:00 +07:00
XMRig
b1c22da6a1 v2.9.3 2019-01-17 12:21:39 +07:00
xmrig
b95ff65eae Update CHANGELOG.md 2019-01-17 12:20:37 +07:00
xmrig
005a09cd98 Merge pull request #912 from SChernykh/master
Correct FP rounding mode for cn/half
2019-01-17 12:12:03 +07:00
SChernykh
e0f5066ded Correct FP rounding mode for cn/half 2019-01-17 00:49:48 +01:00
XMRig
2b15bcbb4f Don't use __builtin___clear_cache on FreeBSD. 2019-01-16 17:53:47 +07:00
xmrig
db646d5d2d Merge pull request #910 from ehaupt/patch-1
FreeBSD needs pthread
2019-01-16 17:50:53 +07:00
Emanuel Haupt
b58e20dde4 FreeBSD needs pthread
FreeBSD needs the pthread linker flag.
2019-01-16 10:55:45 +01:00
XMRig
b11e772acc v2.9.2 2019-01-16 09:17:35 +07:00
xmrig
d1bc03351b Merge pull request #907 from SChernykh/master
Fixed crash in patchCode() on Linux
2019-01-16 09:09:51 +07:00
SChernykh
d1f551da2c Fixed compilation error on Windows 2019-01-16 00:24:34 +01:00
SChernykh
6425c53d61 Fixed crash in patchCode() on Linux 2019-01-16 00:09:00 +01:00
XMRig
118e547175 Restored compatibility with https://stellite.hashvault.pro. 2019-01-16 02:22:29 +07:00
XMRig
d696daf5af Merge branch 'dev' 2019-01-16 00:42:06 +07:00
xmrig
ac60d9426c Update README.md 2019-01-16 00:34:48 +07:00
XMRig
209796a07e v2.9.0 2019-01-16 00:32:02 +07:00
XMRig
a1f19305f4 Merge branch 'dev' 2019-01-16 00:30:15 +07:00
xmrig
dd3243aa70 Update CHANGELOG.md 2019-01-16 00:28:49 +07:00
XMRig
09893bfd36 Fix warnings on macOS. 2019-01-15 18:28:35 +07:00
XMRig
a98c475a3c Fixed wrong ASM code alignment on macOS, thanks @SChernykh. 2019-01-15 18:18:04 +07:00
XMRig
59b147b6fb Merge branch 'pr905' into dev 2019-01-15 02:18:30 +07:00
XMRig
17f28667b3 Code-style/copyright cleanup. 2019-01-15 02:15:36 +07:00
XMRig
63a62e7ea0 Merge branch 'dev' of https://github.com/SChernykh/xmrig into pr905 2019-01-15 01:37:53 +07:00
SChernykh
56cacbd5bc Fixes for Visual Studio 2019-01-14 16:38:28 +01:00
SChernykh
8b9d5cff91 Added ASM code patching when loading
For CNv2 variants with different iterations and memory size.
2019-01-14 15:34:55 +01:00
XMRig
eede1b4881 Allow ignore block version. 2019-01-14 20:59:39 +07:00
XMRig
492449e9fb #899 Add ASM implementation for cn/half. 2019-01-14 18:09:16 +07:00
XMRig
b43336582d Rename ASM files. 2019-01-13 23:00:41 +07:00
XMRig
67863a427d Rename "cn/xtlv9" to "cn/half". 2019-01-13 19:42:27 +07:00
XMRig
1382857c83 #899 Fixed ARM build. 2019-01-13 15:24:04 +07:00
XMRig
84c2cadc50 #899 Initial support for "cn/xtlv9" (C++ only). 2019-01-13 15:03:36 +07:00
XMRig
16b4fd0ff5 Update variant detection for nicehash.com and minergate.com. 2019-01-09 21:47:03 +07:00
XMRig
cfe3995aa8 Sync changes. 2019-01-09 16:43:36 +07:00
XMRig
5382216725 Merge branch 'pr857' into dev 2018-11-20 08:19:29 +07:00
XMRig
c06f77b9e9 Better compiler name and version handling on Linux and macOS for user-agent string. 2018-11-20 08:18:39 +07:00
XMRig
0c930e277b Merge branch 'upstream-osx-compilers' of https://github.com/rivoreo/xmrig into pr857 2018-11-20 08:03:05 +07:00
XMRig
2a2712ab90 Sync changes. 2018-11-20 07:24:14 +07:00
XMRig
9f6f599d78 Sync changes. 2018-11-11 03:18:56 +07:00
XMRig
a76243a65e Sync changes with proxy. 2018-11-06 00:50:28 +07:00
WHR
16babcc6bc Fix impossible to build for OS X without clang 2018-10-30 21:15:49 +08:00
XMRig
3d60b3cc62 #844 Fixed copy/paste typo in comment. 2018-10-25 14:07:15 +07:00
XMRig
acd042c234 #839 Fixed FreeBSD compile. 2018-10-24 09:55:40 +07:00
XMRig
a2e384df58 Merge branch 'feature-asm-bulldozer' into dev 2018-10-22 23:24:26 +07:00
XMRig
735180ac04 Fixed MSVC 2015 build. 2018-10-22 23:17:54 +07:00
XMRig
06a84499d7 Fixed MSYS2 build & copyright 2018-10-22 23:08:29 +07:00
XMRig
caa70a1e9d Merge branch 'dev' of https://github.com/SChernykh/xmrig into feature-asm-bulldozer 2018-10-22 22:52:53 +07:00
XMRig
deb832c9c6 Restore old method for total threads count detection. 2018-10-21 23:52:23 +07:00
XMRig
d7feb2719e v2.8.5-dev 2018-10-21 23:29:17 +07:00
SChernykh
4b91978af6 Added asm optimized code for AMD Bulldozer 2018-10-21 18:29:03 +02:00
XMRig
7e078f2d07 Merge branch 'master' into dev 2018-10-21 23:25:06 +07:00
xmrig
2b0b71b9f6 Update CHANGELOG.md 2018-10-19 10:41:32 +07:00
xmrig
938e652c45 Update CHANGELOG.md 2018-10-19 10:26:12 +07:00
xmrig
20bd22ea22 Update README.md 2018-10-19 10:19:18 +07:00
xmrig
c7c9d20b8b Update CHANGELOG.md 2018-10-19 09:59:14 +07:00
XMRig
dd6aeb26e8 v2.8.3 2018-10-19 09:56:28 +07:00
XMRig
ba0df6e973 Merge branch 'dev' 2018-10-19 09:52:09 +07:00
xmrig
a0f48adf5c Merge pull request #814 from 0xc0d32/patch-1
Update Pool.cpp
2018-10-19 09:40:00 +07:00
_0xc0d32
2b0cac5d4d Update Pool.cpp
Fixed to #813
2018-10-18 22:42:47 -03:00
XMRig
afeaabdca4 v2.8.2-dev 2018-10-15 18:22:45 +07:00
XMRig
6b584a78b2 Merge branch 'master' into dev 2018-10-15 18:21:37 +07:00
xmrig
4bf248f513 Update README.md 2018-10-09 07:41:40 +07:00
XMRig
93b54f8f44 v2.8.1 2018-10-09 07:22:23 +07:00
XMRig
dd7c776ff4 Merge branch 'dev' 2018-10-09 07:19:07 +07:00
xmrig
ff3ae25d16 Update CHANGELOG.md 2018-10-09 07:12:31 +07:00
XMRig
bdc16df418 #777 Make EOF as verbose error too. 2018-10-09 03:47:39 +07:00
XMRig
9ef59366ba Sync changes with proxy. 2018-10-09 02:32:29 +07:00
XMRig
dda8157a7b Add "--tls", "--tls-fingerprint", "--asm" and "--dry-run" to help output. 2018-10-09 01:35:33 +07:00
xmrig
023062b2f1 Update README.md 2018-10-09 01:32:07 +07:00
XMRig
ad92c3b025 Add ASM detection for builds without libcpuid. 2018-10-06 15:13:55 +03:00
xmrig
8f3d405b34 Update CHANGELOG.md 2018-10-06 14:25:59 +03:00
XMRig
20268d5291 #753 Removed unnecessary ext_family and ext_model checks. 2018-10-04 19:10:47 +03:00
XMRig
152c4f2f1b #768 Fixed build error with MSVC 2015 and enabled ASM code. 2018-10-02 17:50:19 +03:00
XMRig
c2f6c70044 #769 Fixed regression with colors. 2018-10-02 13:14:32 +03:00
XMRig
9a70f0e564 v2.8.1-dev 2018-10-02 01:22:13 +03:00
XMRig
0efd995b9b Merge branch 'master' into dev 2018-10-02 01:18:18 +03:00
xmrig
a33fbe32c6 Update README.md 2018-10-01 13:36:03 +03:00
XMRig
dc6d6bd539 v2.8.0-rc 2018-09-30 20:06:46 +03:00
XMRig
880747d0e0 Merge branch 'dev' 2018-09-30 19:59:25 +03:00
XMRig
dc67352ac5 Update default config.json. 2018-09-30 17:57:25 +03:00
xmrig
cb87c244c3 Update README.md 2018-09-30 17:44:10 +03:00
xmrig
ae25c01d36 Merge pull request #766 from Roboto12/patch-1
Update Asm.cpp
2018-09-30 17:36:07 +03:00
xmrig
fa38d97192 Update CHANGELOG.md 2018-09-30 16:20:20 +03:00
XMRig
9a173ce91e Fix default value for "restricted" option. 2018-09-29 18:05:38 +03:00
Roboto12
fbba3d1be6 Update Asm.cpp
parse(value.IsBool()) should be changed to parse(value.GetBool()), otherwise if the 'asm' parameter in config has a boolean value, it will be parse as 'true' even if it's actually 'false'.
2018-09-28 19:18:37 +03:00
xmrig
782a91f7e6 Update README.md 2018-09-28 12:37:21 +03:00
xmrig
52e871b810 Update README.md 2018-09-28 12:36:14 +03:00
XMRig
143da8380e Add "autosave" config option. 2018-09-27 19:07:04 +03:00
XMRig
a63677e255 Fix missing "asm" in generated config. 2018-09-27 17:17:19 +03:00
XMRig
850150dc00 Merge branch 'dev' of github.com:xmrig/xmrig into dev 2018-09-26 20:37:32 +03:00
XMRig
0d197f8906 New donations proxy addresses with SSL/TLS support. 2018-09-26 20:35:27 +03:00
xmrig
03b4e160ec Update CHANGELOG.md 2018-09-25 10:16:29 +03:00
xmrig
18dc19b1e8 Update CHANGELOG.md 2018-09-25 10:15:41 +03:00
XMRig
0d9db273a0 Fix template declaration. 2018-09-25 09:40:09 +03:00
XMRig
1a3de05096 Added ASM code for double hash mode, thanks @SChernykh. 2018-09-25 09:25:47 +03:00
XMRig
c9928a873d Merge branch 'feature-asm' into dev 2018-09-24 23:21:23 +03:00
XMRig
ebcdac7d13 Fixed crash when use ASM code for MSYS2, thanks @SChernykh. 2018-09-24 20:43:31 +03:00
XMRig
f4a867b70f Fix 32bit build. 2018-09-24 14:57:30 +03:00
XMRig
c2fcf23855 Implemented "asm" option. 2018-09-24 14:19:26 +03:00
XMRig
ba65a34a01 Initial ASM wrapper. 2018-09-24 09:51:21 +03:00
XMRig
f163aad38c Fix macOS/Clang build. 2018-09-23 20:45:10 +03:00
XMRig
dd27c42293 Initial compile with ASM. 2018-09-23 20:16:33 +03:00
XMRig
0c20d7a125 Auto-detect proper asm variant. 2018-09-23 19:09:05 +03:00
XMRig
c9fd8061c2 Fix Linux build. 2018-09-23 18:07:44 +03:00
XMRig
ee4d980955 Old static class Cpu replaced to interface ICpuInfo. 2018-09-23 17:51:56 +03:00
XMRig
1f609c7ebd Update libcpuid to recent git version. 2018-09-23 13:05:03 +03:00
xmrig
cf76d9254a Merge pull request #761 from SChernykh/dev
Cryptonight variant 2 - final version
2018-09-23 07:47:02 +03:00
SChernykh
d8ca5ef205 Cryptonight variant 2 - final version
Reference code: https://github.com/monero-project/monero/pull/4404

I tested it on x86 with av=1-10 and on ARM with av=1-4, self test passed.
2018-09-22 17:21:32 +02:00
XMRig
30791de5bc Don't use static OpenSSL on Linux by default. 2018-09-22 16:01:27 +03:00
XMRig
3a7e8647bb Fix for automatic variant specified by pool/proxy. 2018-09-22 15:54:31 +03:00
xmrig
f1a1e0814c Update CHANGELOG.md 2018-09-22 08:54:56 +03:00
xmrig
feb1a758c1 Update CHANGELOG.md 2018-09-22 08:42:15 +03:00
XMRig
0adad68471 # Fixed send buffer overflow and increase send buffer size. 2018-09-20 07:33:32 +03:00
XMRig
dc76879188 Merge branch 'feature-tls' into dev 2018-09-18 04:13:40 +03:00
XMRig
bcd27ca259 Sync changes. 2018-09-18 04:04:25 +03:00
XMRig
4c4e0593a7 Enable TLS by default. 2018-09-17 09:24:18 +03:00
XMRig
2189fe94ed Fix Linux build. 2018-09-17 06:37:53 +03:00
XMRig
a2d2c0418d Fix gcc build with OpenSSL 1.1.1 2018-09-17 01:43:44 +03:00
XMRig
1059189e2c Skip TLS pools if miner built without TLS support. 2018-09-17 01:02:17 +03:00
XMRig
7da9e7a599 Added TLS fingerprint validation. 2018-09-16 08:14:22 +03:00
XMRig
bc9130ded3 Show TLS version. 2018-09-16 06:35:49 +03:00
XMRig
2f3939396e Move shared summary to xmrig::CommonConfig. 2018-09-16 05:04:20 +03:00
XMRig
14ac7b556e Initial TLS support. 2018-09-16 03:06:54 +03:00
XMRig
812cd9760f Added debug thread log. 2018-09-15 16:48:57 +03:00
XMRig
93216a51f4 Fix compile error on macOS. 2018-09-14 22:04:52 +03:00
XMRig
357fbac62b Suppress rapidjson warnings on gcc 8 2018-09-14 21:42:42 +03:00
XMRig
0bc9016124 v2.8.0-dev 2018-09-13 11:20:10 +03:00
XMRig
310ad7fa37 Merge branch 'feature-cn-variant2' into dev 2018-09-13 11:16:10 +03:00
XMRig
23914e9a9f "xmrig::cn_uses_variant1" replaced to "xmrig::cn_base_variant". 2018-09-10 18:35:12 +03:00
XMRig
bb3990a076 Rewrite automatic variant handling. 2018-09-03 15:39:55 +03:00
XMRig
a27dfa8b70 Add WITH_DEBUG_LOG CMake option. 2018-09-03 01:26:19 +03:00
XMRig
a3873930a0 Fixed automatic variant. 2018-09-01 00:31:31 +03:00
XMRig
b948474d01 Small fixes. 2018-09-01 00:00:38 +03:00
XMRig
85946b0c40 Fixed numeric variant 2 in config file. 2018-08-31 23:55:50 +03:00
XMRig
075565e6fa Fix invalid hashes with gcc 7.1. 2018-08-31 23:32:33 +03:00
XMRig
eef4d9b102 Fixed 32 bit support. 2018-08-31 23:19:10 +03:00
XMRig
f11aad515b Fixed gcc build. 2018-08-31 21:51:34 +03:00
XMRig
85b829a1e3 Merge branch 'dev' of https://github.com/SChernykh/xmrig into feature-cn-variant2 2018-08-31 19:46:15 +03:00
XMRig
73fca9114e * Fixed API ID collision. 2018-08-31 18:30:51 +03:00
XMRig
57479cef8c Sync changes. 2018-08-31 18:01:15 +03:00
SChernykh
ea1658c818 Fixed spaces 2018-08-29 20:27:17 +02:00
SChernykh
7c4b718789 Fixed performance degradation for v0 & v1 2018-08-29 20:15:08 +02:00
SChernykh
f151c7131d Removed excess code for v0 & v1 2018-08-29 19:52:33 +02:00
SChernykh
36a562e1f1 Cryptonight variant 2 support
Reference code: https://github.com/monero-project/monero/pull/4218
2018-08-28 23:42:15 +02:00
xmrig
dd8590e6c8 Update ALGORITHMS.md 2018-07-29 19:23:55 +07:00
XMRig
f7b029eb05 Sync changes with AMD miner. 2018-07-20 03:37:07 +07:00
XMRig
e8d6514bd3 2.6.5-dev 2018-07-20 03:18:38 +07:00
XMRig
95092bfadb Merge branch 'master' into dev 2018-07-20 03:06:59 +07:00
xmrig
08e791b60d Update README.md 2018-07-12 02:11:25 +07:00
XMRig
6b7030cd6f v2.6.4 2018-07-12 00:48:30 +07:00
XMRig
b736f0a558 Merge branch 'dev' 2018-07-12 00:39:30 +07:00
xmrig
807b2e9d6e Update ALGORITHMS.md 2018-07-11 20:51:30 +07:00
xmrig
034d2f0c08 Update ALGORITHMS.md 2018-07-11 20:50:55 +07:00
xmrig
4a39321d74 Update CHANGELOG.md 2018-07-11 20:42:16 +07:00
XMRig
0041e9f0c1 Add new algorithms for ARM. 2018-07-10 00:29:16 +07:00
XMRig
969a26fb5d Optimize cn-heavy/tube. 2018-07-09 22:28:53 +07:00
XMRig
dac12a122f Add cn-heavy/tube. 2018-07-09 20:21:53 +07:00
XMRig
2702b6ffc8 Add reference hashes for cn/xao and cn/rto. 2018-07-09 16:54:39 +07:00
XMRig
25bac30862 Added "cn/xao" and "cn/rto". 2018-07-09 16:12:45 +07:00
XMRig
a8de81a51b #714 Simplify cn-heavy/xhv. 2018-07-09 00:23:27 +07:00
XMRig
b719bbfefc Better variant detection for nicehash.com and minergate.com. 2018-06-16 16:08:08 +07:00
XMRig
de6ee749fe #692 Add support for global algorithm variant. 2018-06-14 23:49:30 +07:00
XMRig
33d9094cdc Sync changes with proxy. 2018-06-14 21:49:27 +07:00
XMRig
63fed427f4 2.6.4-dev 2018-06-14 21:25:57 +07:00
XMRig
ae89ca0a5f Merge branch 'master' into dev 2018-06-14 21:06:09 +07:00
XMRig
25dce61369 Merge branch 'dev' 2018-06-13 21:49:13 +07:00
xmrig
8cb7483b2c Update README.md 2018-06-13 21:43:47 +07:00
xmrig
1e2fde0df1 Update CHANGELOG.md 2018-06-11 18:34:24 +07:00
XMRig
859515315c v2.6.3 2018-06-11 16:09:50 +07:00
XMRig
7f169e391d Merge branch 'dev' 2018-06-11 16:05:57 +07:00
XMRig
6a7a7ada2e Fix ARM build. 2018-06-11 15:44:45 +07:00
xmrig
21b2e2ca1e Update CHANGELOG.md 2018-06-11 15:23:06 +07:00
XMRig
1d31f1b0b8 Fix command line option "-a cn-heavy". 2018-06-11 12:26:49 +07:00
XMRig
dab4239aca Added support for cn-heavy/xhv. 2018-06-11 12:00:59 +07:00
XMRig
8908c2c027 Added support for "cn/msr" also known as "cn-fast". 2018-06-10 19:48:34 +07:00
XMRig
974cb4162a Fix Linux build. 2018-06-07 07:17:30 +07:00
XMRig
dba78717fa Move dry-run option to common code. 2018-06-05 11:48:31 +07:00
XMRig
48a214c3f1 Move files. 2018-06-05 07:34:58 +07:00
XMRig
e320b2e928 #672 Reverted back "cryptonight-light" and exit if no valid algorithm specified. 2018-06-04 02:09:29 +07:00
XMRig
1748a7bd57 Fix double hash mode too. 2018-06-03 05:42:10 +07:00
XMRig
6cf24936df #551 Fixed cn-heavy for ARMv8. 2018-06-03 02:56:49 +07:00
XMRig
651637d637 #446 Better fix, second variable always aligned. 2018-06-03 00:22:26 +07:00
XMRig
26ee5028e1 Use native checks instead of XMRIG_ARMv8. 2018-06-03 00:09:59 +07:00
XMRig
d900a6d9dd #446 Fixed SIGBUS error on 32 bit ARM CPUs. 2018-06-02 04:37:12 +07:00
XMRig
5d6a622b18 New detailed hashrate report. 2018-06-01 02:33:21 +07:00
XMRig
009bd1a507 Sync changes with amd miner and update summary. 2018-06-01 01:48:31 +07:00
XMRig
34a3454784 Small fix in CMakeLists.txt. 2018-05-20 14:27:46 +07:00
XMRig
14f0e8658c Sync changes with proxy. 2018-05-19 14:44:50 +07:00
XMRig
6dda4ad41c Merge branch 'feature-log-enhancement' into dev 2018-05-19 14:33:26 +07:00
XMRig
2b3f7f43ce Fix Linux build. 2018-05-19 13:47:27 +07:00
XMRig
5019493332 Correctly reset colors in FileLog. 2018-05-19 13:06:49 +07:00
XMRig
0086020b5c Optimize logs architecture. 2018-05-19 11:48:15 +07:00
XMRig
adc6adb6d5 Merge branch 'master' into dev 2018-05-19 11:06:17 +07:00
xmrig
8ab9f0f860 Merge pull request #629 from rivoreo/upstream-fix-log-file
#629 Fix FileLog (--log-file) fails on non-seekable files
2018-05-17 11:52:43 +07:00
WHR
19f409a85b Fix FileLog error 'invalid seek' on non-seekable files 2018-05-15 03:12:12 +08:00
XMRig
6a4f817693 #615 Fixed build without libcpuid. 2018-05-08 06:19:10 +07:00
XMRig
4cd7af3da1 Merge branch 'master' of github.com:xmrig/xmrig 2018-05-08 02:39:27 +07:00
XMRig
d7d3fec058 #614 Fix display issue with huge pages percentage when colors disabled. 2018-05-08 02:39:11 +07:00
xmrig
8d61df7cc9 Update README.md 2018-05-07 14:27:48 +07:00
xmrig
b383a382eb Update README.md 2018-05-07 02:37:23 +07:00
xmrig
bee1285e3a Update CHANGELOG.md 2018-05-07 02:17:20 +07:00
XMRig
c89889cc57 #607 Fixed donation bug. 2018-05-07 02:09:25 +07:00
XMRig
a1c5afa383 Fix Termux build. 2018-05-07 00:56:39 +07:00
XMRig
a00024cf51 Fixed ARMv8 build. 2018-05-05 22:44:20 +07:00
XMRig
a5325d9021 Merge branch 'master' into dev 2018-05-05 19:32:30 +07:00
128 changed files with 7652 additions and 2530 deletions

View File

@ -1,3 +1,68 @@
# v2.10.0
- [#904](https://github.com/xmrig/xmrig/issues/904) Added new algorithm `cn-pico/trtl` (aliases `cryptonight-turtle`, `cn-trtl`) for upcoming TurtleCoin (TRTL) fork.
- Default value for option `max-cpu-usage` changed to `100` also this option now deprecated.
# v2.9.4
- [#913](https://github.com/xmrig/xmrig/issues/913) Fixed Masari (MSR) support (this update required for upcoming fork).
- [#915](https://github.com/xmrig/xmrig/pull/915) Improved security, JIT memory now read-only after patching.
# v2.9.3
- [#909](https://github.com/xmrig/xmrig/issues/909) Fixed compile errors on FreeBSD.
- [#912](https://github.com/xmrig/xmrig/pull/912) Fixed, C++ implementation of `cn/half` was produce up to 13% of invalid hashes.
# v2.9.2
- [#907](https://github.com/xmrig/xmrig/pull/907) Fixed crash on Linux.
# v2.9.1
- Restored compatibility with https://stellite.hashvault.pro.
# v2.9.0
- [#899](https://github.com/xmrig/xmrig/issues/899) Added support for new algorithm `cn/half` for Masari and Stellite forks.
- [#834](https://github.com/xmrig/xmrig/pull/834) Added ASM optimized code for AMD Bulldozer.
- [#839](https://github.com/xmrig/xmrig/issues/839) Fixed FreeBSD compile.
- [#857](https://github.com/xmrig/xmrig/pull/857) Fixed impossible to build for macOS without clang.
# v2.8.3
- [#813](https://github.com/xmrig/xmrig/issues/813) Fixed critical bug with Minergate pool and variant 2.
# v2.8.1
- [#768](https://github.com/xmrig/xmrig/issues/768) Fixed build with Visual Studio 2015.
- [#769](https://github.com/xmrig/xmrig/issues/769) Fixed regression, some ANSI escape sequences was in log with disabled colors.
- [#777](https://github.com/xmrig/xmrig/issues/777) Better report about pool connection issues.
- Simplified checks for ASM auto detection, only AES support necessary.
- Added missing options to `--help` output.
# v2.8.0
- **[#753](https://github.com/xmrig/xmrig/issues/753) Added new algorithm [CryptoNight variant 2](https://github.com/xmrig/xmrig/issues/753) for Monero fork, thanks [@SChernykh](https://github.com/SChernykh).**
- Added global and per thread option `"asm"` and and command line equivalent.
- **[#758](https://github.com/xmrig/xmrig/issues/758) Added SSL/TLS support for secure connections to pools.**
- Added per pool options `"tls"` and `"tls-fingerprint"` and command line equivalents.
- [#767](https://github.com/xmrig/xmrig/issues/767) Added config autosave feature, same with GPU miners.
- [#245](https://github.com/xmrig/xmrig-proxy/issues/245) Fixed API ID collision when run multiple miners on same machine.
- [#757](https://github.com/xmrig/xmrig/issues/757) Fixed send buffer overflow.
# v2.6.4
- [#700](https://github.com/xmrig/xmrig/issues/700) `cryptonight-lite/ipbc` replaced to `cryptonight-heavy/tube` for **Bittube (TUBE)**.
- Added `cryptonight/rto` (cryptonight variant 1 with IPBC/TUBE mod) variant for **Arto (RTO)** coin.
- Added `cryptonight/xao` (original cryptonight with bigger iteration count) variant for **Alloy (XAO)** coin.
- Better variant detection for **nicehash.com** and **minergate.com**.
- [#692](https://github.com/xmrig/xmrig/issues/692) Added support for specify both algorithm and variant via single `algo` option.
# v2.6.3
- **Added support for new cryptonight-heavy variant xhv** (`cn-heavy/xhv`) for upcoming Haven Protocol fork.
- **Added support for new cryptonight variant msr** (`cn/msr`) also known as `cryptonight-fast` for upcoming Masari fork.
- Added new detailed hashrate report.
- [#446](https://github.com/xmrig/xmrig/issues/446) Likely fixed SIGBUS error on 32 bit ARM CPUs.
- [#551](https://github.com/xmrig/xmrig/issues/551) Fixed `cn-heavy` algorithm on ARMv8.
- [#614](https://github.com/xmrig/xmrig/issues/614) Fixed display issue with huge pages percentage when colors disabled.
- [#615](https://github.com/xmrig/xmrig/issues/615) Fixed build without libcpuid.
- [#629](https://github.com/xmrig/xmrig/pull/629) Fixed file logging with non-seekable files.
- [#672](https://github.com/xmrig/xmrig/pull/672) Reverted back `cryptonight-light` and exit if no valid algorithm specified.
# v2.6.2
- [#607](https://github.com/xmrig/xmrig/issues/607) Fixed donation bug.
- [#610](https://github.com/xmrig/xmrig/issues/610) Fixed ARM build.
# v2.6.1
- [#168](https://github.com/xmrig/xmrig-proxy/issues/168) Added support for [mining algorithm negotiation](https://github.com/xmrig/xmrig-proxy/blob/dev/doc/STRATUM_EXT.md#1-mining-algorithm-negotiation).
- Added IPBC coin support, base algorithm `cn-lite` variant `ipbc`.

View File

@ -1,12 +1,15 @@
cmake_minimum_required(VERSION 2.8)
project(xmrig)
option(WITH_LIBCPUID "Use Libcpuid" ON)
option(WITH_AEON "CryptoNight-Lite support" ON)
option(WITH_SUMO "CryptoNight-Heavy support" ON)
option(WITH_IPBC "CryptoNight-IPBC support" ON)
option(WITH_HTTPD "HTTP REST API" ON)
option(BUILD_STATIC "Build static binary" OFF)
option(WITH_LIBCPUID "Use Libcpuid" ON)
option(WITH_AEON "CryptoNight-Lite support" ON)
option(WITH_SUMO "CryptoNight-Heavy support" ON)
option(WITH_CN_PICO "CryptoNight-Pico support" ON)
option(WITH_HTTPD "HTTP REST API" ON)
option(WITH_DEBUG_LOG "Enable debug log output" OFF)
option(WITH_TLS "Enable OpenSSL support" ON)
option(WITH_ASM "Enable ASM PoW implementations" ON)
option(BUILD_STATIC "Build static binary" OFF)
include (CheckIncludeFile)
include (cmake/cpu.cmake)
@ -15,12 +18,25 @@ include (cmake/cpu.cmake)
set(HEADERS
src/api/NetworkState.h
src/App.h
src/base/tools/String.h
src/common/config/CommonConfig.h
src/common/config/ConfigLoader.h
src/common/config/ConfigWatcher.h
src/common/Console.h
src/common/cpu/Cpu.h
src/common/crypto/Algorithm.h
src/common/crypto/keccak.h
src/common/interfaces/IClientListener.h
src/common/interfaces/IConfig.h
src/common/interfaces/IConfigCreator.h
src/common/interfaces/IConsoleListener.h
src/common/interfaces/IControllerListener.h
src/common/interfaces/ICpuInfo.h
src/common/interfaces/ILogBackend.h
src/common/interfaces/IStrategy.h
src/common/interfaces/IStrategyListener.h
src/common/interfaces/IWatcherListener.h
src/common/log/BasicLog.h
src/common/log/ConsoleLog.h
src/common/log/FileLog.h
src/common/log/Log.h
@ -36,21 +52,10 @@ set(HEADERS
src/common/utils/c_str.h
src/common/utils/mm_malloc.h
src/common/xmrig.h
src/core/Config.cpp
src/core/ConfigLoader_platform.h
src/core/Controller.h
src/Cpu.h
src/interfaces/IClientListener.h
src/interfaces/IConfig.h
src/interfaces/IConfigCreator.h
src/interfaces/IConsoleListener.h
src/interfaces/IControllerListener.h
src/interfaces/IJobResultListener.h
src/interfaces/ILogBackend.h
src/interfaces/IStrategy.h
src/interfaces/IStrategyListener.h
src/interfaces/IThread.h
src/interfaces/IWatcherListener.h
src/interfaces/IWorker.h
src/Mem.h
src/net/JobResult.h
@ -90,12 +95,14 @@ endif()
set(SOURCES
src/api/NetworkState.cpp
src/App.cpp
src/base/tools/String.cpp
src/common/config/CommonConfig.cpp
src/common/config/ConfigLoader.cpp
src/common/config/ConfigWatcher.cpp
src/common/Console.cpp
src/common/crypto/Algorithm.cpp
src/common/crypto/keccak.cpp
src/common/log/BasicLog.cpp
src/common/log/ConsoleLog.cpp
src/common/log/FileLog.cpp
src/common/log/Log.cpp
@ -133,7 +140,6 @@ if (WIN32)
res/app.rc
src/App_win.cpp
src/common/Platform_win.cpp
src/Cpu_win.cpp
src/Mem_win.cpp
)
@ -143,22 +149,20 @@ elseif (APPLE)
set(SOURCES_OS
src/App_unix.cpp
src/common/Platform_mac.cpp
src/Cpu_mac.cpp
src/Mem_unix.cpp
)
else()
set(SOURCES_OS
src/App_unix.cpp
src/common/Platform_unix.cpp
src/Cpu_unix.cpp
src/Mem_unix.cpp
)
set(EXTRA_LIBS pthread rt)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(EXTRA_LIBS ${EXTRA_LIBS} kvm)
if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(EXTRA_LIBS kvm pthread)
else()
set(EXTRA_LIBS pthread rt dl)
endif()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
@ -170,7 +174,6 @@ endif()
add_definitions(/D__STDC_FORMAT_MACROS)
add_definitions(/DUNICODE)
#add_definitions(/DAPP_DEBUG)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
@ -183,17 +186,21 @@ if (WITH_LIBCPUID)
include_directories(src/3rdparty/libcpuid)
set(CPUID_LIB cpuid)
set(SOURCES_CPUID src/Cpu.cpp)
set(SOURCES_CPUID src/core/cpu/AdvancedCpuInfo.h src/core/cpu/AdvancedCpuInfo.cpp src/core/cpu/Cpu.cpp)
else()
add_definitions(/DXMRIG_NO_LIBCPUID)
set(SOURCES_CPUID src/common/cpu/BasicCpuInfo.h src/common/cpu/Cpu.cpp)
if (XMRIG_ARM)
set(SOURCES_CPUID src/Cpu_arm.cpp)
set(SOURCES_CPUID ${SOURCES_CPUID} src/common/cpu/BasicCpuInfo_arm.cpp)
else()
set(SOURCES_CPUID src/Cpu_stub.cpp)
set(SOURCES_CPUID ${SOURCES_CPUID} src/common/cpu/BasicCpuInfo.cpp)
endif()
endif()
include(cmake/OpenSSL.cmake)
include(cmake/asm.cmake)
CHECK_INCLUDE_FILE (syslog.h HAVE_SYSLOG_H)
if (HAVE_SYSLOG_H)
add_definitions(/DHAVE_SYSLOG_H)
@ -212,6 +219,10 @@ if (NOT WITH_IPBC)
add_definitions(/DXMRIG_NO_IPBC)
endif()
if (NOT WITH_CN_PICO)
add_definitions(/DXMRIG_NO_CN_PICO)
endif()
if (WITH_HTTPD)
find_package(MHD)
@ -233,6 +244,7 @@ if (WITH_HTTPD)
message(FATAL_ERROR "microhttpd NOT found: use `-DWITH_HTTPD=OFF` to build without http deamon support")
endif()
else()
set(HTTPD_SOURCES "")
set(MHD_LIBRARY "")
add_definitions(/DXMRIG_NO_HTTPD)
add_definitions(/DXMRIG_NO_API)
@ -246,5 +258,9 @@ if (BUILD_STATIC)
set(CMAKE_EXE_LINKER_FLAGS " -static")
endif()
add_executable(xmrig ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES})
target_link_libraries(xmrig ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})
if (WITH_DEBUG_LOG)
add_definitions(/DAPP_DEBUG)
endif()
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES} ${TLS_SOURCES} ${XMRIG_ASM_SOURCES})
target_link_libraries(${CMAKE_PROJECT_NAME} ${XMRIG_ASM_LIBRARY} ${OPENSSL_LIBRARIES} ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB})

View File

@ -1,7 +1,5 @@
# XMRig
:warning: **You must update miners to version 2.5 before April 6 due [Monero PoW change](https://getmonero.org/2018/02/11/PoW-change-and-key-reuse.html).**
[![Github All Releases](https://img.shields.io/github/downloads/xmrig/xmrig/total.svg)](https://github.com/xmrig/xmrig/releases)
[![GitHub release](https://img.shields.io/github/release/xmrig/xmrig/all.svg)](https://github.com/xmrig/xmrig/releases)
[![GitHub Release Date](https://img.shields.io/github/release-date-pre/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/releases)
@ -52,14 +50,21 @@ Use [config.xmrig.com](https://config.xmrig.com/xmrig) to generate, edit or shar
### Options
```
-a, --algo=ALGO cryptonight (default) or cryptonight-lite
-a, --algo=ALGO specify the algorithm to use
cryptonight
cryptonight-lite
cryptonight-heavy
-o, --url=URL URL of mining server
-O, --userpass=U:P username:password pair for mining server
-u, --user=USERNAME username for mining server
-p, --pass=PASSWORD password for mining server
--rig-id=ID rig identifier for pool-side statistics (needs pool support)
-t, --threads=N number of miner threads
-v, --av=N algorithm variation, 0 auto select
-k, --keepalive send keepalived for prevent timeout (need pool support)
-k, --keepalive send keepalived packet for prevent timeout (needs pool support)
--nicehash enable nicehash.com support
--tls enable SSL/TLS support (needs pool support)
--tls-fingerprint=F pool TLS certificate fingerprint, if set enable strict certificate pinning
-r, --retries=N number of times to retry before switch to backup server (default: 5)
-R, --retry-pause=N time to pause between retries (default: 5)
--cpu-affinity set process affinity to CPU core(s), mask 0x3 for cores 0 and 1
@ -75,23 +80,38 @@ Use [config.xmrig.com](https://config.xmrig.com/xmrig) to generate, edit or shar
-S, --syslog use system log for output messages
--max-cpu-usage=N maximum CPU usage for automatic threads mode (default 75)
--safe safe adjust threads and av settings for current CPU
--nicehash enable nicehash/xmrig-proxy support
--asm=ASM ASM code for cn/2, possible values: auto, none, intel, ryzen.
--print-time=N print hashrate report every N seconds
--api-port=N port for the miner API
--api-access-token=T access token for API
--api-worker-id=ID custom worker-id for API
--api-id=ID custom instance ID for API
--api-ipv6 enable IPv6 support for API
--api-no-restricted enable full remote access (only if API token set)
--dry-run test configuration and exit
-h, --help display this help and exit
-V, --version output version information and exit
```
Also you can use configuration via config file, default **config.json**. You can load multiple config files and combine it with command line options.
Also you can use configuration via config file, default name **config.json**. Some options available only via config file: [`autosave`](https://github.com/xmrig/xmrig/issues/767), [`hw-aes`](https://github.com/xmrig/xmrig/issues/563). `watch` option currently not implemented in miners only in proxy.
## Algorithm variations
Since version 0.8.0.
* `--av=1` For CPUs with hardware AES.
* `--av=2` Lower power mode (double hash) of `1`.
* `--av=3` Software AES implementation.
* `--av=4` Lower power mode (double hash) of `3`.
- `av` option used for automatic and simple threads mode (when you specify only threads count).
- For [advanced threads mode](https://github.com/xmrig/xmrig/issues/563) each thread configured individually and `av` option not used.
| av | Hashes per round | Hardware AES |
|----|------------------|--------------|
| 1 | 1 (Single) | yes |
| 2 | 2 (Double) | yes |
| 3 | 1 (Single) | no |
| 4 | 2 (Double) | no |
| 5 | 3 (Triple) | yes |
| 6 | 4 (Quard) | yes |
| 7 | 5 (Penta) | yes |
| 8 | 3 (Triple) | no |
| 9 | 4 (Quard) | no |
| 10 | 5 (Penta) | no |
## Common Issues
### HUGE PAGES unavailable
@ -100,8 +120,7 @@ Since version 0.8.0.
## Other information
* No HTTP support, only stratum protocol support.
* No TLS support.
* Default donation 5% (5 minutes in 100 minutes) can be reduced to 1% via command line option `--donate-level`.
* Default donation 5% (5 minutes in 100 minutes) can be reduced to 1% via option `donate-level`.
### CPU mining performance
@ -121,15 +140,7 @@ Please note performance is highly dependent on system load. The numbers above ar
* XMR: `48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD`
* BTC: `1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT`
## Release checksums
### SHA-256
```
f8e1957e8bfd7f281a76d1e42694049c67f39dea90ac36e9d589c14cdf8924bc xmrig-2.6.1-xenial-amd64.tar.gz/xmrig-2.6.1/xmrig
472c7aaf5aacc1212bfd3f2f96daca4f42d64e2d0db0872891328e7d8503d0c8 xmrig-2.6.1-gcc-win32.zip/xmrig.exe
d53154cef24c884b2be539ac13bfb6e7dba6bbc53b62e91f2877637d43fa4b15 xmrig-2.6.1-gcc-win64.zip/xmrig.exe
a253381b617463e6e1193d49b8afbf720a1c376621da7429d97f192668cd59ad xmrig-2.6.1-msvc-win64.zip/xmrig.exe
```
## Contacts
* support@xmrig.com
* [reddit](https://www.reddit.com/user/XMRig/)
* [twitter](https://twitter.com/xmrig_dev)

25
cmake/OpenSSL.cmake Normal file
View File

@ -0,0 +1,25 @@
if (WITH_TLS)
set(OPENSSL_ROOT_DIR ${XMRIG_DEPS})
if (WIN32)
set(OPENSSL_USE_STATIC_LIBS TRUE)
set(OPENSSL_MSVC_STATIC_RT TRUE)
set(EXTRA_LIBS ${EXTRA_LIBS} Crypt32)
endif()
find_package(OpenSSL)
if (OPENSSL_FOUND)
set(TLS_SOURCES src/common/net/Tls.h src/common/net/Tls.cpp)
include_directories(${OPENSSL_INCLUDE_DIR})
else()
message(FATAL_ERROR "OpenSSL NOT found: use `-DWITH_TLS=OFF` to build without TLS support")
endif()
else()
set(TLS_SOURCES "")
set(OPENSSL_LIBRARIES "")
add_definitions(/DXMRIG_NO_TLS)
set(CMAKE_PROJECT_NAME "${CMAKE_PROJECT_NAME}-notls")
endif()

33
cmake/asm.cmake Normal file
View File

@ -0,0 +1,33 @@
if (WITH_ASM AND NOT XMRIG_ARM AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(XMRIG_ASM_LIBRARY "xmrig-asm")
if (CMAKE_C_COMPILER_ID MATCHES MSVC)
enable_language(ASM_MASM)
if (MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
set(XMRIG_ASM_FILE "src/crypto/asm/cn_main_loop.asm")
else()
set(XMRIG_ASM_FILE "src/crypto/asm/win64/cn_main_loop.asm")
endif()
set_property(SOURCE ${XMRIG_ASM_FILE} PROPERTY ASM_MASM)
else()
enable_language(ASM)
if (WIN32 AND CMAKE_C_COMPILER_ID MATCHES GNU)
set(XMRIG_ASM_FILE "src/crypto/asm/win64/cn_main_loop.S")
else()
set(XMRIG_ASM_FILE "src/crypto/asm/cn_main_loop.S")
endif()
set_property(SOURCE ${XMRIG_ASM_FILE} PROPERTY C)
endif()
add_library(${XMRIG_ASM_LIBRARY} STATIC ${XMRIG_ASM_FILE})
set(XMRIG_ASM_SOURCES src/crypto/Asm.h src/crypto/Asm.cpp)
set_property(TARGET ${XMRIG_ASM_LIBRARY} PROPERTY LINKER_LANGUAGE C)
else()
set(XMRIG_ASM_SOURCES "")
set(XMRIG_ASM_LIBRARY "")
add_definitions(/DXMRIG_NO_ASM)
endif()

View File

@ -15,7 +15,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-strict-aliasing")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions -fno-rtti")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions -fno-rtti -Wno-class-memaccess")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -s")
if (XMRIG_ARMv8)

View File

@ -6,38 +6,25 @@ Algorithm selection splitted to 2 parts:
* Global base algorithm per miner or proxy instance, `algo` option. Possible values: `cryptonight`, `cryptonight-lite`, `cryptonight-heavy`.
* Algorithm variant specified separately for each pool, `variant` option.
* [Full table for supported algorithm and variants.](https://github.com/xmrig/xmrig-proxy/blob/master/doc/STRATUM_EXT.md#14-algorithm-names-and-variants)
#### Example
```json
{
"algo": "cryptonight",
...
"pools": [
{
"url": "...",
"variant": 1,
...
}
],
...
}
```
Possible variants for `cryptonight`:
* `0` Original cryptonight.
* `1` cryptonight variant 1, also known as cryptonight v7 or monero7.
* `"xtl"` Stellite coin variant.
Possible variants for `cryptonight-lite`:
* `0` Original cryptonight-lite.
* `1` cryptonight-lite variant 1, also known as cryptonight-lite v7 or aeon7.
* `"ipbc"` IPBC coin variant.
For `cryptonight-heavy` currently no variants.
### Cheatsheet
You mine **Sumokoin** or **Haven Protocol**?
Your algorithm is `cryptonight-heavy` no variant option need.
You mine **Aeon**, **TurtleCoin** or **IPBC**?
Your base algorithm is `cryptonight-lite`:
Variants:
* Aeon: `-1` autodetect. `0` right now, `1` after fork.
* TurtleCoin: `1`.
* IPBC: `"ipbc"`.
In all other cases base algorithm is `cryptonight`.
### Mining algorithm negotiation
## Mining algorithm negotiation
If your pool support [mining algorithm negotiation](https://github.com/xmrig/xmrig-proxy/issues/168) miner will choice proper variant automaticaly and if you choice wrong base algorithm you will see error message.
Pools with mining algorithm negotiation support.

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +1,71 @@
/*
* Copyright 2008 Veselin Georgiev,
* anrieffNOSPAM @ mgail_DOT.com (convert to gmail)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 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.
*/
#ifndef __ASM_BITS_H__
#define __ASM_BITS_H__
#include "libcpuid.h"
/* Determine Compiler: */
#if defined(_MSC_VER)
# define COMPILER_MICROSOFT
#elif defined(__GNUC__)
# define COMPILER_GCC
#endif
/* Determine Platform */
#if defined(__x86_64__) || defined(_M_AMD64)
# define PLATFORM_X64
#elif defined(__i386__) || defined(_M_IX86)
# define PLATFORM_X86
#endif
/* Under Windows/AMD64 with MSVC, inline assembly isn't supported */
#if (defined(COMPILER_GCC) && defined(PLATFORM_X64)) || defined(PLATFORM_X86)
# define INLINE_ASM_SUPPORTED
#endif
int cpuid_exists_by_eflags(void);
void exec_cpuid(uint32_t *regs);
void busy_sse_loop(int cycles);
#endif /* __ASM_BITS_H__ */
/*
* Copyright 2008 Veselin Georgiev,
* anrieffNOSPAM @ mgail_DOT.com (convert to gmail)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 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.
*/
#ifndef __ASM_BITS_H__
#define __ASM_BITS_H__
#include "libcpuid.h"
/* Determine Compiler: */
#if defined(_MSC_VER)
#if !defined(COMPILER_MICROSOFT)
# define COMPILER_MICROSOFT
#endif
#elif defined(__GNUC__)
#if !defined(COMPILER_GCC)
# define COMPILER_GCC
#endif
#elif defined(__clang__)
#if !defined(COMPILER_CLANG)
# define COMPILER_CLANG
#endif
#endif
/* Determine Platform */
#if defined(__x86_64__) || defined(_M_AMD64)
#if !defined(PLATFORM_X64)
# define PLATFORM_X64
#endif
#elif defined(__i386__) || defined(_M_IX86)
#if !defined(PLATFORM_X86)
# define PLATFORM_X86
#endif
#elif defined(__ARMEL__)
#if !defined(PLATFORM_ARM)
# define PLATFORM_ARM
#endif
#endif
/* Under Windows/AMD64 with MSVC, inline assembly isn't supported */
#if (((defined(COMPILER_GCC) || defined(COMPILER_CLANG))) && \
(defined(PLATFORM_X64) || defined(PLATFORM_X86) || defined(PLATFORM_ARM))) || \
(defined(COMPILER_MICROSOFT) && defined(PLATFORM_X86))
# define INLINE_ASM_SUPPORTED
#endif
int cpuid_exists_by_eflags(void);
void exec_cpuid(uint32_t *regs);
void busy_sse_loop(int cycles);
#endif /* __ASM_BITS_H__ */

View File

@ -221,42 +221,42 @@ static void load_features_common(struct cpu_raw_data_t* raw, struct cpu_id_t* da
static cpu_vendor_t cpuid_vendor_identify(const uint32_t *raw_vendor, char *vendor_str)
{
int i;
cpu_vendor_t vendor = VENDOR_UNKNOWN;
const struct { cpu_vendor_t vendor; char match[16]; }
matchtable[NUM_CPU_VENDORS] = {
/* source: http://www.sandpile.org/ia32/cpuid.htm */
{ VENDOR_INTEL , "GenuineIntel" },
{ VENDOR_AMD , "AuthenticAMD" },
{ VENDOR_CYRIX , "CyrixInstead" },
{ VENDOR_NEXGEN , "NexGenDriven" },
{ VENDOR_TRANSMETA , "GenuineTMx86" },
{ VENDOR_UMC , "UMC UMC UMC " },
{ VENDOR_CENTAUR , "CentaurHauls" },
{ VENDOR_RISE , "RiseRiseRise" },
{ VENDOR_SIS , "SiS SiS SiS " },
{ VENDOR_NSC , "Geode by NSC" },
};
int i;
cpu_vendor_t vendor = VENDOR_UNKNOWN;
const struct { cpu_vendor_t vendor; char match[16]; }
matchtable[NUM_CPU_VENDORS] = {
/* source: http://www.sandpile.org/ia32/cpuid.htm */
{ VENDOR_INTEL , "GenuineIntel" },
{ VENDOR_AMD , "AuthenticAMD" },
{ VENDOR_CYRIX , "CyrixInstead" },
{ VENDOR_NEXGEN , "NexGenDriven" },
{ VENDOR_TRANSMETA , "GenuineTMx86" },
{ VENDOR_UMC , "UMC UMC UMC " },
{ VENDOR_CENTAUR , "CentaurHauls" },
{ VENDOR_RISE , "RiseRiseRise" },
{ VENDOR_SIS , "SiS SiS SiS " },
{ VENDOR_NSC , "Geode by NSC" },
};
memcpy(vendor_str + 0, &raw_vendor[1], 4);
memcpy(vendor_str + 4, &raw_vendor[3], 4);
memcpy(vendor_str + 8, &raw_vendor[2], 4);
vendor_str[12] = 0;
memcpy(vendor_str + 0, &raw_vendor[1], 4);
memcpy(vendor_str + 4, &raw_vendor[3], 4);
memcpy(vendor_str + 8, &raw_vendor[2], 4);
vendor_str[12] = 0;
/* Determine vendor: */
for (i = 0; i < NUM_CPU_VENDORS; i++)
if (!strcmp(vendor_str, matchtable[i].match)) {
vendor = matchtable[i].vendor;
break;
}
return vendor;
/* Determine vendor: */
for (i = 0; i < NUM_CPU_VENDORS; i++)
if (!strcmp(vendor_str, matchtable[i].match)) {
vendor = matchtable[i].vendor;
break;
}
return vendor;
}
static int cpuid_basic_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* data)
{
int i, j, basic, xmodel, xfamily, ext;
char brandstr[64] = {0};
data->vendor = cpuid_vendor_identify(raw->basic_cpuid[0], data->vendor_str);
data->vendor = cpuid_vendor_identify(raw->basic_cpuid[0], data->vendor_str);
if (data->vendor == VENDOR_UNKNOWN)
return set_error(ERR_CPU_UNKN);

View File

@ -60,7 +60,7 @@
*/
/** @mainpage A simple libcpuid introduction
*
*
* LibCPUID provides CPU identification and access to the CPUID and RDTSC
* instructions on the x86.
* <p>
@ -82,6 +82,7 @@
*/
/** @defgroup libcpuid LibCPUID
* @brief LibCPUID provides CPU identification
@{ */
/* Include some integer type specifications: */
@ -535,23 +536,23 @@ typedef enum {
* @brief Describes common library error codes
*/
typedef enum {
ERR_OK = 0, /*!< "No error" */
ERR_NO_CPUID = -1, /*!< "CPUID instruction is not supported" */
ERR_NO_RDTSC = -2, /*!< "RDTSC instruction is not supported" */
ERR_NO_MEM = -3, /*!< "Memory allocation failed" */
ERR_OPEN = -4, /*!< "File open operation failed" */
ERR_BADFMT = -5, /*!< "Bad file format" */
ERR_NOT_IMP = -6, /*!< "Not implemented" */
ERR_CPU_UNKN = -7, /*!< "Unsupported processor" */
ERR_NO_RDMSR = -8, /*!< "RDMSR instruction is not supported" */
ERR_NO_DRIVER= -9, /*!< "RDMSR driver error (generic)" */
ERR_NO_PERMS = -10, /*!< "No permissions to install RDMSR driver" */
ERR_EXTRACT = -11, /*!< "Cannot extract RDMSR driver (read only media?)" */
ERR_HANDLE = -12, /*!< "Bad handle" */
ERR_INVMSR = -13, /*!< "Invalid MSR" */
ERR_INVCNB = -14, /*!< "Invalid core number" */
ERR_HANDLE_R = -15, /*!< "Error on handle read" */
ERR_INVRANGE = -16, /*!< "Invalid given range" */
ERR_OK = 0, /*!< No error */
ERR_NO_CPUID = -1, /*!< CPUID instruction is not supported */
ERR_NO_RDTSC = -2, /*!< RDTSC instruction is not supported */
ERR_NO_MEM = -3, /*!< Memory allocation failed */
ERR_OPEN = -4, /*!< File open operation failed */
ERR_BADFMT = -5, /*!< Bad file format */
ERR_NOT_IMP = -6, /*!< Not implemented */
ERR_CPU_UNKN = -7, /*!< Unsupported processor */
ERR_NO_RDMSR = -8, /*!< RDMSR instruction is not supported */
ERR_NO_DRIVER= -9, /*!< RDMSR driver error (generic) */
ERR_NO_PERMS = -10, /*!< No permissions to install RDMSR driver */
ERR_EXTRACT = -11, /*!< Cannot extract RDMSR driver (read only media?) */
ERR_HANDLE = -12, /*!< Bad handle */
ERR_INVMSR = -13, /*!< Invalid MSR */
ERR_INVCNB = -14, /*!< Invalid core number */
ERR_HANDLE_R = -15, /*!< Error on handle read */
ERR_INVRANGE = -16, /*!< Invalid given range */
} cpu_error_t;
/**
@ -668,7 +669,7 @@ struct cpu_epc_t cpuid_get_epc(int index, const struct cpu_raw_data_t* raw);
const char* cpuid_lib_version(void);
#ifdef __cplusplus
}; /* extern "C" */
} /* extern "C" */
#endif

View File

@ -75,8 +75,9 @@ enum _intel_bits_t {
_3 = LBIT( 14 ),
_5 = LBIT( 15 ),
_7 = LBIT( 16 ),
XEON_ = LBIT( 17 ),
ATOM_ = LBIT( 18 ),
_9 = LBIT( 17 ),
XEON_ = LBIT( 18 ),
ATOM_ = LBIT( 19 ),
};
typedef enum _intel_bits_t intel_bits_t;

View File

@ -32,6 +32,32 @@
#ifndef __LIBCPUID_TYPES_H__
#define __LIBCPUID_TYPES_H__
#include <stdint.h>
#if !defined(_MSC_VER) || _MSC_VER >= 1600
# include <stdint.h>
#else
/* we have to provide our own: */
# if !defined(__int32_t_defined)
typedef int int32_t;
# endif
# if !defined(__uint32_t_defined)
typedef unsigned uint32_t;
# endif
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
#if (defined _MSC_VER) && (_MSC_VER <= 1300)
/* MSVC 6.0: no long longs ... */
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
/* all other sane compilers: */
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#endif
#endif
#endif /* __LIBCPUID_TYPES_H__ */

View File

@ -49,6 +49,10 @@ enum _amd_model_codes_t {
_1400,
_1500,
_1600,
_1900,
_2400,
_2500,
_2700,
};
static void load_amd_features(struct cpu_raw_data_t* raw, struct cpu_id_t* data)

View File

@ -376,7 +376,7 @@ static intel_code_and_bits_t get_brand_code_and_bits(struct cpu_id_t* data)
bits |= bit_matchtable[i].bit;
}
if ((i = match_pattern(bs, "Core(TM) [im][357]")) != 0) {
if ((i = match_pattern(bs, "Core(TM) [im][3579]")) != 0) {
bits |= CORE_;
i--;
switch (bs[i + 9]) {
@ -387,6 +387,7 @@ static intel_code_and_bits_t get_brand_code_and_bits(struct cpu_id_t* data)
case '3': bits |= _3; break;
case '5': bits |= _5; break;
case '7': bits |= _7; break;
case '9': bits |= _9; break;
}
}
for (i = 0; i < COUNT_OF(matchtable); i++)

View File

@ -29,11 +29,11 @@
#include "api/Api.h"
#include "App.h"
#include "common/Console.h"
#include "common/cpu/Cpu.h"
#include "common/log/Log.h"
#include "common/Platform.h"
#include "core/Config.h"
#include "core/Controller.h"
#include "Cpu.h"
#include "crypto/CryptoNight.h"
#include "Mem.h"
#include "net/Network.h"
@ -87,6 +87,10 @@ App::~App()
int App::exec()
{
if (m_controller->isDone()) {
return 0;
}
if (!m_controller->isReady()) {
return 2;
}

View File

@ -28,7 +28,7 @@
#include <uv.h>
#include "interfaces/IConsoleListener.h"
#include "common/interfaces/IConsoleListener.h"
class Console;

View File

@ -6,7 +6,8 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 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
@ -33,7 +34,6 @@ bool Mem::m_enabled = true;
int Mem::m_flags = 0;
MemInfo Mem::create(cryptonight_ctx **ctx, xmrig::Algo algorithm, size_t count)
{
using namespace xmrig;
@ -41,11 +41,9 @@ MemInfo Mem::create(cryptonight_ctx **ctx, xmrig::Algo algorithm, size_t count)
MemInfo info;
info.size = cn_select_memory(algorithm) * count;
# ifndef XMRIG_NO_AEON
info.size += info.size % cn_select_memory<CRYPTONIGHT>();
# endif
info.pages = info.size / cn_select_memory<CRYPTONIGHT>();
constexpr const size_t align_size = 2 * 1024 * 1024;
info.size = ((info.size + align_size - 1) / align_size) * align_size;
info.pages = info.size / align_size;
allocate(info, m_enabled);

View File

@ -6,7 +6,8 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 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
@ -22,8 +23,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MEM_H__
#define __MEM_H__
#ifndef XMRIG_MEM_H
#define XMRIG_MEM_H
#include <stddef.h>
@ -59,6 +60,10 @@ public:
static void init(bool enabled);
static void release(cryptonight_ctx **ctx, size_t count, MemInfo &info);
static void *allocateExecutableMemory(size_t size);
static void protectExecutableMemory(void *p, size_t size);
static void flushInstructionCache(void *p, size_t size);
static inline bool isHugepagesAvailable() { return (m_flags & HugepagesAvailable) != 0; }
private:
@ -70,4 +75,4 @@ private:
};
#endif /* __MEM_H__ */
#endif /* XMRIG_MEM_H */

View File

@ -6,7 +6,8 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 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
@ -87,3 +88,27 @@ void Mem::release(MemInfo &info)
_mm_free(info.memory);
}
}
void *Mem::allocateExecutableMemory(size_t size)
{
# if defined(__APPLE__)
return mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0);
# else
return mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
# endif
}
void Mem::protectExecutableMemory(void *p, size_t size)
{
mprotect(p, size, PROT_READ | PROT_EXEC);
}
void Mem::flushInstructionCache(void *p, size_t size)
{
# ifndef __FreeBSD__
__builtin___clear_cache(reinterpret_cast<char*>(p), reinterpret_cast<char*>(p) + size);
# endif
}

View File

@ -6,7 +6,8 @@
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 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
@ -182,3 +183,22 @@ void Mem::release(MemInfo &info)
_mm_free(info.memory);
}
}
void *Mem::allocateExecutableMemory(size_t size)
{
return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
}
void Mem::protectExecutableMemory(void *p, size_t size)
{
DWORD oldProtect;
VirtualProtect(p, size, PAGE_EXECUTE_READ, &oldProtect);
}
void Mem::flushInstructionCache(void *p, size_t size)
{
::FlushInstructionCache(GetCurrentProcess(), p, size);
}

View File

@ -5,6 +5,7 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2018 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
@ -27,44 +28,42 @@
#include <uv.h>
#include "common/cpu/Cpu.h"
#include "common/log/Log.h"
#include "common/net/Pool.h"
#include "core/Config.h"
#include "core/Controller.h"
#include "Cpu.h"
#include "crypto/Asm.h"
#include "Mem.h"
#include "Summary.h"
#include "version.h"
static void print_versions(xmrig::Config *config)
#ifndef XMRIG_NO_ASM
static const char *coloredAsmNames[] = {
"\x1B[1;31mnone\x1B[0m",
"auto",
"\x1B[1;32mintel\x1B[0m",
"\x1B[1;32mryzen\x1B[0m",
"\x1B[1;32mbulldozer\x1B[0m"
};
inline static const char *asmName(xmrig::Assembly assembly, bool colors)
{
char buf[16];
# if defined(__clang__)
snprintf(buf, 16, " clang/%d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
# elif defined(__GNUC__)
snprintf(buf, 16, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
# elif defined(_MSC_VER)
snprintf(buf, 16, " MSVC/%d", MSVC_VERSION);
# else
buf[0] = '\0';
# endif
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mVERSIONS: \x1B[01;36mXMRig/%s\x1B[01;37m libuv/%s%s" : " * VERSIONS: XMRig/%s libuv/%s%s",
APP_VERSION, uv_version_string(), buf);
return colors ? coloredAsmNames[assembly] : xmrig::Asm::toString(assembly);
}
#endif
static void print_memory(xmrig::Config *config) {
# ifdef _WIN32
if (config->isColors()) {
Log::i()->text("\x1B[01;32m * \x1B[01;37mHUGE PAGES: %s",
Mem::isHugepagesAvailable() ? "\x1B[01;32mavailable" : "\x1B[01;31munavailable");
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
"HUGE PAGES", Mem::isHugepagesAvailable() ? "\x1B[1;32mavailable" : "\x1B[01;31munavailable");
}
else {
Log::i()->text(" * HUGE PAGES: %s", Mem::isHugepagesAvailable() ? "available" : "unavailable");
Log::i()->text(" * %-13s%s", "HUGE PAGES", Mem::isHugepagesAvailable() ? "available" : "unavailable");
}
# endif
}
@ -72,20 +71,23 @@ static void print_memory(xmrig::Config *config) {
static void print_cpu(xmrig::Config *config)
{
using namespace xmrig;
if (config->isColors()) {
Log::i()->text("\x1B[01;32m * \x1B[01;37mCPU: %s (%d) %sx64 %sAES-NI",
Cpu::brand(),
Cpu::sockets(),
Cpu::isX64() ? "\x1B[01;32m" : "\x1B[01;31m-",
Cpu::hasAES() ? "\x1B[01;32m" : "\x1B[01;31m-");
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%d)") " %sx64 %sAES",
"CPU",
Cpu::info()->brand(),
Cpu::info()->sockets(),
Cpu::info()->isX64() ? "\x1B[1;32m" : "\x1B[1;31m-",
Cpu::info()->hasAES() ? "\x1B[1;32m" : "\x1B[1;31m-");
# ifndef XMRIG_NO_LIBCPUID
Log::i()->text("\x1B[01;32m * \x1B[01;37mCPU L2/L3: %.1f MB/%.1f MB", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%.1f MB/%.1f MB"), "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
# endif
}
else {
Log::i()->text(" * CPU: %s (%d) %sx64 %sAES-NI", Cpu::brand(), Cpu::sockets(), Cpu::isX64() ? "" : "-", Cpu::hasAES() ? "" : "-");
Log::i()->text(" * %-13s%s (%d) %sx64 %sAES", "CPU", Cpu::info()->brand(), Cpu::info()->sockets(), Cpu::info()->isX64() ? "" : "-", Cpu::info()->hasAES() ? "" : "-");
# ifndef XMRIG_NO_LIBCPUID
Log::i()->text(" * CPU L2/L3: %.1f MB/%.1f MB", Cpu::l2() / 1024.0, Cpu::l3() / 1024.0);
Log::i()->text(" * %-13s%.1f MB/%.1f MB", "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
# endif
}
}
@ -94,87 +96,66 @@ static void print_cpu(xmrig::Config *config)
static void print_threads(xmrig::Config *config)
{
if (config->threadsMode() != xmrig::Config::Advanced) {
char buf[32];
char buf[32] = { 0 };
if (config->affinity() != -1L) {
snprintf(buf, 32, ", affinity=0x%" PRIX64, config->affinity());
}
else {
buf[0] = '\0';
snprintf(buf, sizeof buf, ", affinity=0x%" PRIX64, config->affinity());
}
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mTHREADS: \x1B[01;36m%d\x1B[01;37m, %s, av=%d, %sdonate=%d%%%s" : " * THREADS: %d, %s, av=%d, %sdonate=%d%%%s",
Log::i()->text(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, av=%d, %sdonate=%d%%") WHITE_BOLD("%s")
: " * %-13s%d, %s, av=%d, %sdonate=%d%%%s",
"THREADS",
config->threadsCount(),
config->algorithm().name(),
config->algoVariant(),
config->isColors() && config->donateLevel() == 0 ? "\x1B[01;31m" : "",
config->isColors() && config->donateLevel() == 0 ? "\x1B[1;31m" : "",
config->donateLevel(),
buf);
}
else {
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mTHREADS: \x1B[01;36m%d\x1B[01;37m, %s, %sdonate=%d%%" : " * THREADS: %d, %s, %sdonate=%d%%",
Log::i()->text(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, %sdonate=%d%%")
: " * %-13s%d, %s, %sdonate=%d%%",
"THREADS",
config->threadsCount(),
config->algorithm().name(),
config->isColors() && config->donateLevel() == 0 ? "\x1B[01;31m" : "",
config->isColors() && config->donateLevel() == 0 ? "\x1B[1;31m" : "",
config->donateLevel());
}
}
# ifndef XMRIG_NO_ASM
if (config->assembly() == xmrig::ASM_AUTO) {
const xmrig::Assembly assembly = xmrig::Cpu::info()->assembly();
static void print_pools(xmrig::Config *config)
{
const std::vector<Pool> &pools = config->pools();
for (size_t i = 0; i < pools.size(); ++i) {
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mPOOL #%d: \x1B[01;36m%s" : " * POOL #%d: %s",
i + 1,
pools[i].url()
);
Log::i()->text(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13sauto:%s")
: " * %-13sauto:%s", "ASSEMBLY", asmName(assembly, config->isColors()));
}
# ifdef APP_DEBUG
for (const Pool &pool : pools) {
pool.print();
else {
Log::i()->text(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s") : " * %-13s%s", "ASSEMBLY", asmName(config->assembly(), config->isColors()));
}
# endif
}
#ifndef XMRIG_NO_API
static void print_api(xmrig::Config *config)
{
const int port = config->apiPort();
if (port == 0) {
return;
}
Log::i()->text(config->isColors() ? "\x1B[01;32m * \x1B[01;37mAPI BIND: \x1B[01;36m%s:%d" : " * API BIND: %s:%d",
config->isApiIPv6() ? "[::]" : "0.0.0.0", port);
}
#endif
static void print_commands(xmrig::Config *config)
{
if (config->isColors()) {
Log::i()->text("\x1B[01;32m * \x1B[01;37mCOMMANDS: \x1B[01;35mh\x1B[01;37mashrate, \x1B[01;35mp\x1B[01;37mause, \x1B[01;35mr\x1B[01;37mesume");
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BOLD("h") WHITE_BOLD("ashrate, ")
MAGENTA_BOLD("p") WHITE_BOLD("ause, ")
MAGENTA_BOLD("r") WHITE_BOLD("esume"));
}
else {
Log::i()->text(" * COMMANDS: 'h' hashrate, 'p' pause, 'r' resume");
Log::i()->text(" * COMMANDS 'h' hashrate, 'p' pause, 'r' resume");
}
}
void Summary::print(xmrig::Controller *controller)
{
print_versions(controller->config());
controller->config()->printVersions();
print_memory(controller->config());
print_cpu(controller->config());
print_threads(controller->config());
print_pools(controller->config());
# ifndef XMRIG_NO_API
print_api(controller->config());
# endif
controller->config()->printPools();
controller->config()->printAPI();
print_commands(controller->config());
}

View File

@ -35,14 +35,13 @@
#include "api/ApiRouter.h"
#include "common/api/HttpReply.h"
#include "common/api/HttpRequest.h"
#include "common/cpu/Cpu.h"
#include "common/crypto/keccak.h"
#include "common/net/Job.h"
#include "common/Platform.h"
#include "core/Config.h"
#include "core/Controller.h"
#include "Cpu.h"
#include "interfaces/IThread.h"
#include "Mem.h"
#include "rapidjson/document.h"
#include "rapidjson/prettywriter.h"
#include "rapidjson/stringbuffer.h"
@ -67,7 +66,7 @@ ApiRouter::ApiRouter(xmrig::Controller *controller) :
memset(m_workerId, 0, sizeof(m_workerId));
setWorkerId(controller->config()->apiWorkerId());
genId();
genId(controller->config()->apiId());
}
@ -145,10 +144,15 @@ void ApiRouter::finalize(xmrig::HttpReply &reply, rapidjson::Document &doc) cons
}
void ApiRouter::genId()
void ApiRouter::genId(const char *id)
{
memset(m_id, 0, sizeof(m_id));
if (id && strlen(id) > 0) {
strncpy(m_id, id, sizeof(m_id) - 1);
return;
}
uv_interface_address_t *interfaces;
int count = 0;
@ -160,11 +164,13 @@ void ApiRouter::genId()
if (!interfaces[i].is_internal && interfaces[i].address.address4.sin_family == AF_INET) {
uint8_t hash[200];
const size_t addrSize = sizeof(interfaces[i].phys_addr);
const size_t inSize = strlen(APP_KIND) + addrSize;
const size_t inSize = strlen(APP_KIND) + addrSize + sizeof(uint16_t);
const uint16_t port = static_cast<uint16_t>(m_controller->config()->apiPort());
uint8_t *input = new uint8_t[inSize]();
memcpy(input, interfaces[i].phys_addr, addrSize);
memcpy(input + addrSize, APP_KIND, strlen(APP_KIND));
memcpy(input, &port, sizeof(uint16_t));
memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, strlen(APP_KIND));
xmrig::keccak(input, inSize, hash);
Job::toHex(hash, 8, m_id);
@ -232,13 +238,14 @@ void ApiRouter::getIdentify(rapidjson::Document &doc) const
void ApiRouter::getMiner(rapidjson::Document &doc) const
{
using namespace xmrig;
auto &allocator = doc.GetAllocator();
rapidjson::Value cpu(rapidjson::kObjectType);
cpu.AddMember("brand", rapidjson::StringRef(Cpu::brand()), allocator);
cpu.AddMember("aes", Cpu::hasAES(), allocator);
cpu.AddMember("x64", Cpu::isX64(), allocator);
cpu.AddMember("sockets", Cpu::sockets(), allocator);
cpu.AddMember("brand", rapidjson::StringRef(Cpu::info()->brand()), allocator);
cpu.AddMember("aes", Cpu::info()->hasAES(), allocator);
cpu.AddMember("x64", Cpu::info()->isX64(), allocator);
cpu.AddMember("sockets", Cpu::info()->sockets(), allocator);
doc.AddMember("version", APP_VERSION, allocator);
doc.AddMember("kind", APP_KIND, allocator);

View File

@ -26,7 +26,7 @@
#include "api/NetworkState.h"
#include "interfaces/IControllerListener.h"
#include "common/interfaces/IControllerListener.h"
#include "rapidjson/fwd.h"
@ -56,7 +56,7 @@ protected:
private:
void finalize(xmrig::HttpReply &reply, rapidjson::Document &doc) const;
void genId();
void genId(const char *id);
void getConnection(rapidjson::Document &doc) const;
void getHashrate(rapidjson::Document &doc) const;
void getIdentify(rapidjson::Document &doc) const;
@ -66,7 +66,7 @@ private:
void setWorkerId(const char *id);
void updateWorkerId(const char *id, const char *previousId);
char m_id[17];
char m_id[32];
char m_workerId[128];
NetworkState m_network;
xmrig::Controller *m_controller;

225
src/base/tools/String.cpp Normal file
View File

@ -0,0 +1,225 @@
/* 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-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2016-2019 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "base/tools/String.h"
#include "rapidjson/document.h"
xmrig::String::String(const char *str) :
m_data(nullptr),
m_size(str == nullptr ? 0 : strlen(str))
{
if (m_size == 0) {
return;
}
m_data = new char[m_size + 1];
memcpy(m_data, str, m_size + 1);
}
xmrig::String::String(const char *str, size_t size) :
m_data(nullptr),
m_size(size)
{
if (str == nullptr) {
m_size = 0;
return;
}
m_data = new char[m_size + 1];
memcpy(m_data, str, m_size);
m_data[m_size] = '\0';
}
xmrig::String::String(const String &other) :
m_data(nullptr),
m_size(other.m_size)
{
if (other.m_data == nullptr) {
return;
}
m_data = new char[m_size + 1];
memcpy(m_data, other.m_data, m_size + 1);
}
bool xmrig::String::isEqual(const char *str) const
{
return (m_data != nullptr && str != nullptr && strcmp(m_data, str) == 0) || (m_data == nullptr && str == nullptr);
}
bool xmrig::String::isEqual(const String &other) const
{
if (m_size != other.m_size) {
return false;
}
return (m_data != nullptr && other.m_data != nullptr && memcmp(m_data, other.m_data, m_size) == 0) || (m_data == nullptr && other.m_data == nullptr);
}
rapidjson::Value xmrig::String::toJSON() const
{
using namespace rapidjson;
return isNull() ? Value(kNullType) : Value(StringRef(m_data));
}
rapidjson::Value xmrig::String::toJSON(rapidjson::Document &doc) const
{
using namespace rapidjson;
return isNull() ? Value(kNullType) : Value(m_data, doc.GetAllocator());
}
std::vector<xmrig::String> xmrig::String::split(char sep) const
{
std::vector<xmrig::String> out;
if (m_size == 0) {
return out;
}
size_t start = 0;
size_t pos = 0;
for (pos = 0; pos < m_size; ++pos) {
if (m_data[pos] == sep) {
if ((pos - start) > 0) {
out.push_back(String(m_data + start, pos - start));
}
start = pos + 1;
}
}
if ((pos - start) > 0) {
out.push_back(String(m_data + start, pos - start));
}
return out;
}
xmrig::String xmrig::String::join(const std::vector<xmrig::String> &vec, char sep)
{
if (vec.empty()) {
return String();
}
size_t size = vec.size();
for (const String &str : vec) {
size += str.size();
}
size_t offset = 0;
char *buf = new char[size];
for (const String &str : vec) {
memcpy(buf + offset, str.data(), str.size());
offset += str.size() + 1;
if (offset < size) {
buf[offset - 1] = sep;
}
}
buf[size - 1] = '\0';
return String(buf);
}
void xmrig::String::copy(const char *str)
{
delete [] m_data;
if (str == nullptr) {
m_size = 0;
m_data = nullptr;
return;
}
m_size = strlen(str);
m_data = new char[m_size + 1];
memcpy(m_data, str, m_size + 1);
}
void xmrig::String::copy(const String &other)
{
if (m_size > 0) {
if (m_size == other.m_size) {
memcpy(m_data, other.m_data, m_size + 1);
return;
}
delete [] m_data;
}
delete [] m_data;
if (other.m_data == nullptr) {
m_size = 0;
m_data = nullptr;
return;
}
m_size = other.m_size;
m_data = new char[m_size + 1];
memcpy(m_data, other.m_data, m_size + 1);
}
void xmrig::String::move(char *str)
{
delete [] m_data;
m_size = str == nullptr ? 0 : strlen(str);
m_data = str;
}
void xmrig::String::move(String &&other)
{
delete [] m_data;
m_data = other.m_data;
m_size = other.m_size;
other.m_data = nullptr;
other.m_size = 0;
}

104
src/base/tools/String.h Normal file
View File

@ -0,0 +1,104 @@
/* 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-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2016-2018 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_STRING_H
#define XMRIG_STRING_H
#include <utility>
#include <vector>
#include "rapidjson/fwd.h"
namespace xmrig {
/**
* @brief Simple C string wrapper.
*
* 1. I know about std:string.
* 2. For some reason I prefer don't use std:string in miner, eg because of file size of MSYS2 builds.
* 3. nullptr and JSON conversion supported.
*/
class String
{
public:
inline String() : m_data(nullptr), m_size(0) {}
inline String(char *str) : m_data(str), m_size(str == nullptr ? 0 : strlen(str)) {}
inline String(String &&other) : m_data(other.m_data), m_size(other.m_size) { other.m_data = nullptr; other.m_size = 0; }
String(const char *str);
String(const char *str, size_t size);
String(const String &other);
inline ~String() { delete [] m_data; }
bool isEqual(const char *str) const;
bool isEqual(const String &other) const;
inline bool contains(const char *str) const { return isNull() ? false : strstr(m_data, str) != nullptr; }
inline bool isEmpty() const { return size() == 0; }
inline bool isNull() const { return m_data == nullptr; }
inline char *data() { return m_data; }
inline const char *data() const { return m_data; }
inline size_t size() const { return m_size; }
inline bool operator!=(const char *str) const { return !isEqual(str); }
inline bool operator!=(const String &other) const { return !isEqual(other); }
inline bool operator<(const String &str) const { return strcmp(data(), str.data()) < 0; }
inline bool operator==(const char *str) const { return isEqual(str); }
inline bool operator==(const String &other) const { return isEqual(other); }
inline operator const char*() const { return m_data; }
inline String &operator=(char *str) { move(str); return *this; }
inline String &operator=(const char *str) { copy(str); return *this; }
inline String &operator=(const String &str) { copy(str); return *this; }
inline String &operator=(String &&other) { move(std::move(other)); return *this; }
rapidjson::Value toJSON() const;
rapidjson::Value toJSON(rapidjson::Document &doc) const;
std::vector<xmrig::String> split(char sep) const;
static String join(const std::vector<xmrig::String> &vec, char sep);
private:
void copy(const char *str);
void copy(const String &other);
void move(char *str);
void move(String &&other);
char *m_data;
size_t m_size;
};
} /* namespace xmrig */
#endif /* XMRIG_STRING_H */

View File

@ -4,8 +4,9 @@
* 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 2016-2017 XMRig <support@xmrig.com>
*
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2018 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
@ -26,11 +27,17 @@
#include <uv.h>
#ifndef XMRIG_NO_TLS
# include <openssl/ssl.h>
# include <openssl/err.h>
#endif
#include "Platform.h"
char Platform::m_defaultConfigName[520] = { 0 };
xmrig::c_str Platform::m_userAgent;
xmrig::String Platform::m_userAgent;
const char *Platform::defaultConfigName()
@ -61,3 +68,23 @@ const char *Platform::defaultConfigName()
*m_defaultConfigName = '\0';
return nullptr;
}
void Platform::init(const char *userAgent)
{
# ifndef XMRIG_NO_TLS
SSL_library_init();
SSL_load_error_strings();
ERR_load_BIO_strings();
ERR_load_crypto_strings();
SSL_load_error_strings();
OpenSSL_add_all_digests();
# endif
if (userAgent) {
m_userAgent = userAgent;
}
else {
m_userAgent = createUserAgent();
}
}

View File

@ -4,8 +4,9 @@
* 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 2016-2017 XMRig <support@xmrig.com>
*
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2018 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
@ -21,14 +22,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PLATFORM_H__
#define __PLATFORM_H__
#ifndef XMRIG_PLATFORM_H
#define XMRIG_PLATFORM_H
#include <stdint.h>
#include "common/utils/c_str.h"
#include "base/tools/String.h"
class Platform
@ -36,16 +37,20 @@ class Platform
public:
static bool setThreadAffinity(uint64_t cpu_id);
static const char *defaultConfigName();
static uint32_t setTimerResolution(uint32_t resolution);
static void init(const char *userAgent);
static void restoreTimerResolution();
static void setProcessPriority(int priority);
static void setThreadPriority(int priority);
static inline const char *userAgent() { return m_userAgent.data(); }
private:
static char *createUserAgent();
static char m_defaultConfigName[520];
static xmrig::c_str m_userAgent;
static xmrig::String m_userAgent;
};
#endif /* __PLATFORM_H__ */
#endif /* XMRIG_PLATFORM_H */

View File

@ -38,17 +38,22 @@
#endif
static inline char *createUserAgent()
char *Platform::createUserAgent()
{
const size_t max = 160;
constexpr const size_t max = 256;
char *buf = new char[max];
char *buf = new char[max]();
int length = snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s", APP_NAME, APP_VERSION, uv_version_string());
# ifdef XMRIG_NVIDIA_PROJECT
const int cudaVersion = cuda_get_runtime_version();
snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s CUDA/%d.%d clang/%d.%d.%d", APP_NAME, APP_VERSION, uv_version_string(), cudaVersion / 1000, cudaVersion % 100, __clang_major__, __clang_minor__, __clang_patchlevel__);
# else
snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s clang/%d.%d.%d", APP_NAME, APP_VERSION, uv_version_string(), __clang_major__, __clang_minor__, __clang_patchlevel__);
length += snprintf(buf + length, max - length, " CUDA/%d.%d", cudaVersion / 1000, cudaVersion % 100);
# endif
# ifdef __clang__
length += snprintf(buf + length, max - length, " clang/%d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
# elif defined(__GNUC__)
length += snprintf(buf + length, max - length, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
# endif
return buf;
@ -65,20 +70,19 @@ bool Platform::setThreadAffinity(uint64_t cpu_id)
}
void Platform::init(const char *userAgent)
uint32_t Platform::setTimerResolution(uint32_t resolution)
{
return resolution;
}
void Platform::restoreTimerResolution()
{
if (userAgent) {
m_userAgent = userAgent;
}
else {
m_userAgent = createUserAgent();
}
}
void Platform::setProcessPriority(int priority)
{
}

View File

@ -29,11 +29,13 @@
#endif
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h>
#include <unistd.h>
#include <uv.h>
@ -50,11 +52,11 @@ typedef cpuset_t cpu_set_t;
#endif
static inline char *createUserAgent()
char *Platform::createUserAgent()
{
const size_t max = 160;
constexpr const size_t max = 256;
char *buf = new char[max];
char *buf = new char[max]();
int length = snprintf(buf, max, "%s/%s (Linux ", APP_NAME, APP_VERSION);
# if defined(__x86_64__)
@ -68,7 +70,9 @@ static inline char *createUserAgent()
length += snprintf(buf + length, max - length, " CUDA/%d.%d", cudaVersion / 1000, cudaVersion % 100);
# endif
# ifdef __GNUC__
# ifdef __clang__
length += snprintf(buf + length, max - length, " clang/%d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
# elif defined(__GNUC__)
length += snprintf(buf + length, max - length, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
# endif
@ -90,14 +94,14 @@ bool Platform::setThreadAffinity(uint64_t cpu_id)
}
void Platform::init(const char *userAgent)
uint32_t Platform::setTimerResolution(uint32_t resolution)
{
return resolution;
}
void Platform::restoreTimerResolution()
{
if (userAgent) {
m_userAgent = userAgent;
}
else {
m_userAgent = createUserAgent();
}
}
@ -106,7 +110,6 @@ void Platform::setProcessPriority(int priority)
}
void Platform::setThreadPriority(int priority)
{
if (priority == -1) {

Some files were not shown because too many files have changed in this diff Show More