Compare commits

..

3 Commits

Author SHA1 Message Date
5b416e076a
非常坏 2024-05-25 15:15:29 +08:00
f6c32973ac
aaaa 2024-05-25 13:57:59 +08:00
a09c6a9332
todo 0.3.1 2024-05-25 12:49:51 +08:00
11 changed files with 335 additions and 797 deletions

328
Cargo.lock generated
View File

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "addr2line"
version = "0.22.0"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
dependencies = [
"gimli",
]
@ -61,48 +61,47 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.6.14"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.7"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
[[package]]
name = "anstyle-parse"
version = "0.2.4"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.0"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.3"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
dependencies = [
"anstyle",
"windows-sys 0.52.0",
@ -110,9 +109,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.86"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
dependencies = [
"backtrace",
]
@ -140,20 +139,20 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
name = "autocfg"
version = "1.3.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
[[package]]
name = "backtrace"
version = "0.3.73"
version = "0.3.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
dependencies = [
"addr2line",
"cc",
@ -223,9 +222,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "bytemuck"
version = "1.16.1"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15"
[[package]]
name = "bytes"
@ -235,9 +234,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]]
name = "cc"
version = "1.0.99"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695"
checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b"
[[package]]
name = "cfg-if"
@ -268,9 +267,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.7"
version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f"
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
dependencies = [
"clap_builder",
"clap_derive",
@ -278,9 +277,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.7"
version = "4.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f"
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
dependencies = [
"anstream",
"anstyle",
@ -290,21 +289,21 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.5"
version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
name = "clap_lex"
version = "0.7.1"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
[[package]]
name = "codespan-reporting"
@ -318,9 +317,9 @@ dependencies = [
[[package]]
name = "colorchoice"
version = "1.0.1"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "colored"
@ -401,62 +400,6 @@ dependencies = [
"libc",
]
[[package]]
name = "crossbeam"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-epoch",
"crossbeam-queue",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-queue"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]]
name = "d3d12"
version = "0.19.0"
@ -464,7 +407,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307"
dependencies = [
"bitflags 2.5.0",
"libloading 0.8.4",
"libloading 0.8.3",
"winapi",
]
@ -541,7 +484,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
@ -615,7 +558,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
@ -650,9 +593,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.15"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
dependencies = [
"cfg-if",
"js-sys",
@ -663,9 +606,9 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.29.0"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "gl_generator"
@ -753,9 +696,9 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.14.5"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
"ahash",
"allocator-api2",
@ -770,7 +713,7 @@ dependencies = [
"bitflags 2.5.0",
"com",
"libc",
"libloading 0.8.4",
"libloading 0.8.3",
"thiserror",
"widestring",
"winapi",
@ -818,9 +761,9 @@ dependencies = [
[[package]]
name = "httparse"
version = "1.9.4"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
[[package]]
name = "httpdate"
@ -830,9 +773,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hyper"
version = "0.14.29"
version = "0.14.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33"
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
dependencies = [
"bytes",
"futures-channel",
@ -909,12 +852,6 @@ dependencies = [
"hashbrown",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
[[package]]
name = "itoa"
version = "1.0.11"
@ -943,7 +880,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
dependencies = [
"libc",
"libloading 0.8.4",
"libloading 0.8.3",
"pkg-config",
]
@ -955,15 +892,15 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
[[package]]
name = "lazy_static"
version = "1.5.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.155"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "libloading"
@ -977,9 +914,9 @@ dependencies = [
[[package]]
name = "libloading"
version = "0.8.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
dependencies = [
"cfg-if",
"windows-targets 0.52.5",
@ -987,9 +924,9 @@ dependencies = [
[[package]]
name = "lock_api"
version = "0.4.12"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
dependencies = [
"autocfg",
"scopeguard",
@ -1012,9 +949,9 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.7.4"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "metal"
@ -1039,9 +976,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "miniz_oxide"
version = "0.7.4"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
dependencies = [
"adler",
]
@ -1117,9 +1054,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-traits"
version = "0.2.19"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
@ -1155,9 +1092,9 @@ dependencies = [
[[package]]
name = "object"
version = "0.36.0"
version = "0.32.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434"
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
dependencies = [
"memchr",
]
@ -1182,9 +1119,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "parking_lot"
version = "0.12.3"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
@ -1192,22 +1129,22 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.10"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-targets 0.52.5",
"windows-targets 0.48.5",
]
[[package]]
name = "paste"
version = "1.0.15"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]]
name = "percent-encoding"
@ -1277,9 +1214,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.86"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
dependencies = [
"unicode-ident",
]
@ -1307,24 +1244,24 @@ checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab"
[[package]]
name = "raw-window-handle"
version = "0.6.2"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
checksum = "8cc3bcbdb1ddfc11e700e62968e6b4cc9c75bb466464ad28fb61c5b2c964418b"
[[package]]
name = "redox_syscall"
version = "0.5.2"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 2.5.0",
"bitflags 1.3.2",
]
[[package]]
name = "regex"
version = "1.10.5"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
@ -1334,9 +1271,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.7"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
@ -1345,9 +1282,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.4"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "renderdoc-sys"
@ -1399,9 +1336,9 @@ dependencies = [
[[package]]
name = "rustc-demangle"
version = "0.1.24"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "rustc-hash"
@ -1444,9 +1381,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.18"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
[[package]]
name = "schannel"
@ -1475,11 +1412,11 @@ dependencies = [
[[package]]
name = "security-framework"
version = "2.11.0"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0"
checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6"
dependencies = [
"bitflags 2.5.0",
"bitflags 1.3.2",
"core-foundation",
"core-foundation-sys",
"libc",
@ -1488,9 +1425,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
version = "2.11.0"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7"
checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef"
dependencies = [
"core-foundation-sys",
"libc",
@ -1498,29 +1435,29 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.203"
version = "1.0.198"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.203"
version = "1.0.198"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
name = "serde_json"
version = "1.0.117"
version = "1.0.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
dependencies = [
"indexmap",
"itoa",
@ -1536,7 +1473,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
@ -1583,9 +1520,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "socket2"
version = "0.5.7"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871"
dependencies = [
"libc",
"windows-sys 0.52.0",
@ -1649,9 +1586,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.67"
version = "2.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90"
checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3"
dependencies = [
"proc-macro2",
"quote",
@ -1707,22 +1644,22 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.61"
version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.61"
version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
@ -1783,9 +1720,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.38.0"
version = "1.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
dependencies = [
"backtrace",
"bytes",
@ -1802,13 +1739,13 @@ dependencies = [
[[package]]
name = "tokio-macros"
version = "2.3.0"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
@ -1847,7 +1784,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]
[[package]]
@ -1894,13 +1831,12 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "tswn"
version = "0.3.2"
version = "0.3.1"
dependencies = [
"base16384",
"chrono",
"clap",
"colored",
"crossbeam",
"tracing",
"tracing-subscriber",
"windows-sys 0.48.0",
@ -1935,9 +1871,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]]
name = "unicode-width"
version = "0.1.13"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "unicode-xid"
@ -1959,9 +1895,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.2"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
dependencies = [
"form_urlencoded",
"idna",
@ -1976,9 +1912,9 @@ checksum = "110352d4e9076c67839003c7788d8604e24dcded13e0b375af3efaa8cf468517"
[[package]]
name = "utf8parse"
version = "0.2.2"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "valuable"
@ -2028,7 +1964,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
"wasm-bindgen-shared",
]
@ -2062,7 +1998,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -2187,7 +2123,7 @@ dependencies = [
"js-sys",
"khronos-egl",
"libc",
"libloading 0.8.4",
"libloading 0.8.3",
"log",
"metal",
"naga",
@ -2436,20 +2372,20 @@ checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"
[[package]]
name = "zerocopy"
version = "0.7.34"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.34"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
"syn 2.0.60",
]

View File

@ -1,20 +1,19 @@
[package]
name = "tswn"
description = "tool shenjack work shop namerena"
version = "0.3.2"
version = "0.3.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "4.5", features = ["derive"] }
clap = { version = "4.5.4", features = ["derive"] }
base16384 = "0.1.0"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["time"] }
chrono = "0.4"
colored = "2.1.0"
crossbeam = { version = "0.8.4", features = ["crossbeam-channel"] }
# windows 下额外指定一个 windows 依赖 (微软赛高!)
# 用于在 bench 状态下指定核心(就是闲得)
@ -28,7 +27,3 @@ windows-sys = { version = "*", features = [
[features]
default = ["simd"]
simd = []
[[bin]]
name = "xp2"
path = "./src/xp_eval.rs"

View File

@ -1,35 +1,5 @@
# 还是benchmark
## 0.3.0
```text
.\runs\tswn-030.exe --team shenjack -x 5500 --end 1000000000 -t 2 -r 2
2024-06-23T18:23:01.267212Z INFO tswn: 输出文件: "./namerena/namerena-shenjack-2024-06-24_02-23-01.csv"
2024-06-23T18:23:01.267455Z INFO tswn: 开始: 0 结尾: 1000000000 总计: 1000000000
线程数: 2
八围预期: 640
强评/强单最低值: 5500
队伍名: shenjack
时间 batch 大小: 2s
2024-06-23T18:23:01.267605Z INFO tswn: 设置进程亲和性 3 成功 1
2024-06-23T18:23:01.267712Z INFO tswn::cacluate: 开始分发任务(动态 batch)
2024-06-23T18:23:01.267668Z INFO tswn::cacluate: 线程 thread_0 开始计算
2024-06-23T18:23:01.267656Z INFO tswn::cacluate: 线程 thread_1 开始计算
2024-06-23T18:23:01.267817Z INFO tswn: 设置线程亲和性 1 成功 3
2024-06-23T18:23:01.267864Z INFO tswn: 设置线程亲和性 2 成功 3
2024-06-23T18:23:01.286091Z INFO tswn::cacluate: | 1|Id: 20000|476.66E/d 0.02s↑|476.658E/d|0 |0.002% 0:30:12|
2024-06-23T18:23:01.286988Z INFO tswn::cacluate: | 0|Id: 10000|453.50E/d 0.02s↑|930.153E/d|0 |0.112% 0:15:27|
2024-06-23T18:23:03.343359Z INFO tswn::cacluate: | 0|Id: 2173132|441.08E/d 2.06s↓|917.736E/d|0 |0.217% 0:15:39|
2024-06-23T18:23:03.405951Z INFO tswn::cacluate: | 1|Id: 1123374|449.73E/d 2.12s↓|890.812E/d|0 |0.319% 0:16:6|
2024-06-23T18:23:05.358594Z INFO tswn::cacluate: | 0|Id: 3194146|437.83E/d 2.01s↓|887.565E/d|0 |0.424% 0:16:9|
2024-06-23T18:23:05.401429Z INFO tswn::cacluate: | 1|Id: 4235196|450.78E/d 2.00s↑|888.613E/d|0 |0.525% 0:16:7|
2024-06-23T18:23:07.315577Z INFO tswn::cacluate: | 0|Id: 5248694|447.49E/d 1.96s↑|898.267E/d|0 |0.629% 0:15:55|
2024-06-23T18:23:07.392359Z INFO tswn::cacluate: | 1|Id: 6292170|452.87E/d 1.99s↑|900.352E/d|0 |0.733% 0:15:52|
2024-06-23T18:23:09.347710Z INFO tswn::cacluate: | 0|Id: 7328016|440.46E/d 2.03s↓|893.323E/d|0 |0.838% 0:15:59|
```
## before
> --team shenjacka -q 5500 --end 1000000000 --bench
>
> 5800x 单核

View File

@ -4,9 +4,11 @@
### 0.3.1
其实写了一大堆东西了, 就是懒得统计了
现在重写了一遍任务分发机制
然后会在结束的时候统计一下总效率
- 去掉了 `--bench` 选项
- 现在可以直接使用 `--core-pick` 选项来选择核心了
- 并且单线程模式下效果和 benchmark 模式下一样了
> 然后我准备改成内置多进程模式
### 0.3.0
@ -19,8 +21,6 @@
反正现在在我的 5800x 上能跑到 700E/d (单线程) 了
> 我预计在后面加一下多线程运行的时候加个总计效率
去掉了 `--bench`
## 0.2.15~16
一些提前过滤的东西
@ -30,19 +30,3 @@
### 0.1.6~9
更新了一大堆核心亲和性相关的东西
### 0.1.3
> 550E/d
夸张, 比 0.1.1 快了 100E/d
### 0.1.2
优化了一些边界检查, 反正就是没用
`445E/d -> 478E/d`
参考 bench/tswn.md
### 0.1.1
随手发一版

View File

@ -1,21 +1,13 @@
use crate::{
evaluate::NamerEvaluater,
name::{Namer, TeamNamer},
Command,
};
use std::{
intrinsics::{likely, unlikely},
io::Write,
ops::Range,
path::PathBuf,
time::Instant,
};
use std::{io::Write, path::PathBuf};
use base16384::Base16384Utf8;
use colored::Colorize;
use crossbeam::channel::{bounded, Receiver, Sender};
use tracing::{debug, info, warn};
use tracing::{info, warn};
/// 根据 u64 生成对应的 name
/// 转换成 base 16384
@ -30,386 +22,166 @@ pub fn gen_name(id: u64) -> String {
}
pub struct CacluateConfig {
/// 开始的 id
pub start: u64,
/// 结束的 id
pub end: u64,
/// 线程 id
pub thread_id: u32,
/// 线程数
pub thread_count: u32,
/// 八围预期值
pub prop_expect: u32,
/// qp 预期值
pub xp_expect: u32,
pub qp_expect: u32,
/// 队伍名称
pub team: String,
///
pub time_based: bool,
/// 预期状态输出时间间隔 (秒)
pub report_interval: u64,
/// 可能的设置指定核心亲和性
pub core_affinity: Option<usize>,
/// 输出文件名
pub out_file: PathBuf,
}
pub type WorkInfo = Option<(ThreadId, Range<u64>)>;
/// 用于在先成之间共享的运行状态
/// 正常状态下是会在多个线程之间共享的
/// 单线程状态下就直接在主线程里面
/// 用于记录当前各个线程的计算状态
pub struct ComputeStatus {
/// 总计算数
pub start: u64,
/// 总计算数
pub end: u64,
/// top
pub top_id: u64,
/// 当前各个线程的计算速度
pub thread_speed: Vec<u64>,
/// 当前各个线程是否在运算
pub thread_running: Vec<bool>,
/// 各个线程筛到了几个
pub thread_get_count: Vec<u64>,
/// 用于收集统计信息的结构体
pub struct RunStatus {
/// 工作位置
/// 每一个线程对应一组
pub work_batches: Vec<(u128, u128)>,
/// 每个线程的效率回报
pub work_speed: Vec<u32>,
/// 每个线程是否需要干活
/// work batch 大小
pub work_batch: u32,
}
impl ComputeStatus {
pub fn new(config: &Command) -> Self {
ComputeStatus {
start: config.start,
end: config.end,
top_id: config.start,
thread_speed: vec![0; config.thread_count as usize],
thread_running: vec![false; config.thread_count as usize],
thread_get_count: vec![0; config.thread_count as usize],
}
/// 启动计算的调度函数
pub fn start_main(cli_config: crate::Command, outfile: PathBuf) {
if cli_config.is_single_core() {
// 单核的处理
}
// if cli_arg.bench {
// info!("开始 benchmark");
// cli_arg.thread_count = 1;
// let mut config = cli_arg.as_cacl_config();
// config.core_affinity = Some(1 << cli_arg.pick_core);
// set_process_cores(config.core_affinity.unwrap());
// cacluate::cacl(config, 1, &out_path);
// } else {
// let mut n = 0;
// let mut cores = 0;
// if cli_arg.thread_count == 1 {
// // 单线程运行的时候也是让他放在主线程跑
// let mut config = cli_arg.as_cacl_config();
// config.core_affinity = Some(1 << cli_arg.pick_core);
// set_process_cores(config.core_affinity.unwrap());
// cacluate::cacl(config, 1, &out_path);
// } else {
// for i in 0..cli_arg.thread_count {
// n += 1;
// let mut config = cli_arg.as_cacl_config();
// // 核心亲和性: n, n+1
// config.core_affinity = Some(1 << i);
// cores |= 1 << i;
// let out_path = out_path.clone();
// let thread_name = format!("thread_{}", n);
// threads.push(std::thread::spawn(move || {
// info!("线程 {} 开始计算", thread_name);
// cacluate::cacl(config, n, &out_path);
// info!("线程 {} 结束计算", thread_name);
// }));
// }
// set_process_cores(cores);
// }
// }
pub fn get_idle_thread(&self) -> Option<usize> { self.thread_running.iter().position(|&x| !x) }
pub fn all_stoped(&self) -> bool { self.thread_running.iter().all(|&x| !x) }
pub fn update_speed(&mut self, thread_id: ThreadId, speed: u64) { self.thread_speed[thread_id as usize] = speed; }
pub fn update_running(&mut self, thread_id: ThreadId, running: bool) { self.thread_running[thread_id as usize] = running; }
pub fn add_get_count(&mut self, thread_id: ThreadId, count: u64) { self.thread_get_count[thread_id as usize] += count; }
pub fn count_speed(&self) -> u64 { self.thread_speed.iter().sum() }
pub fn get_sum_count(&self) -> u64 { self.thread_get_count.iter().sum() }
pub fn predict_time(&self) -> chrono::Duration {
let speed = self.count_speed();
let remain = self.end - self.top_id;
chrono::Duration::milliseconds((remain as f64 / speed as f64 * 1000.0) as i64)
}
// for t in threads {
// t.join().unwrap();
// }
}
pub fn start_main(cli_arg: Command, out_path: PathBuf) {
if cli_arg.is_single_thread() {
// 单线程运行的时候也是让他放在主线程跑
let config = cli_arg.as_cacl_config(&out_path);
crate::set_process_cores(config.core_affinity.unwrap());
// cacl(config);
todo!("单线程模式下的调度逻辑没写完呢, 为了保证性能")
} else {
schdule_threads(cli_arg, out_path);
}
}
pub type ThreadId = u32;
/// 描述一下思路吧
///
/// 首先, 本地有几个信息
/// sended: 一个数组, 用于记录每个线程是否已经发送了消息
/// shared_status: 一个共享的状态, 用于记录每个线程的状态
/// threads: 一个线程数组, 用于 hold 住线程
///
/// 其中, shared_status 里面记录了每个线程的状态
/// 里面的 thread_running 用于在分发任务的时候判断是否有线程空闲和哪个线程空闲
///
/// 初始化分发的时候的逻辑如下:
/// 1. 初始化一个 0 大小的 bounded channel
///
/// 分发任务(消息)的时候的逻辑如下:
/// - 如果是 固定大小 的 batch
/// 1. 每次直接发送一个 id 为 -1 (即任意线程都可以接收的) 的消息
/// - 如果是 动态大小 的 batch
/// 0. 等待回返的 request work 的消息
/// 1. 遍历 sended 中 true 的部分, 检查对应 thread_running 是否为 true
/// 2. 如果为 true, 则将对应 sended 置为 false
/// 3. 找到 sended 中 第一个为 false 的线程, 根据 thread_speed 计算出一个合适的 batch
/// 4. 发送一个对应线程 id 的消息
///
/// 最后结尾的时候的逻辑如下:
/// - 如果是 固定大小 的 batch
/// 1.每次发送之前检测是不是快完事了 ( batch size > 剩余 work size )
/// 2.如果是, 则发送剩余的 work, 并且把 ended 置为 true
/// 3.ended 为 true 的时候, 再发送消息的时候直接发送 None
/// - 如果是 动态大小 的 batch
pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) {
let mut cores = 0;
let mut thread = vec![];
let mut shared_status = ComputeStatus::new(&cli_arg);
let (work_sender, work_receiver) = bounded::<WorkInfo>(0);
let (work_requester, thread_waiter) = bounded::<(ThreadId, u32)>(0);
for i in 0..cli_arg.thread_count {
// 每一个线程
let mut config = cli_arg.as_cacl_config(&out_path);
config.thread_id = i;
let work_receiver = work_receiver.clone();
let work_requester = work_requester.clone();
let shared_status: &mut ComputeStatus = unsafe {
// 直接获取一个共享状态的引用
// 这个对象是可以在多个线程之间共享的
// 但是 rust 不让我这么干
// 所以, unsafe == trust_me
std::mem::transmute::<&mut ComputeStatus, &mut ComputeStatus>(&mut shared_status)
};
config.core_affinity = Some(1 << i);
cores |= 1 << i;
let thread_name = format!("thread_{}", i);
thread.push(std::thread::spawn(move || {
info!("线程 {} 开始计算", thread_name);
cacl(config, shared_status, work_receiver, work_requester);
info!("线程 {} 结束计算", thread_name);
}));
}
crate::set_process_cores(cores);
// 任务分发
// 判断是否所有 work 都分发完了
// 当前分发到的 work 的 最大 index
let full_start_time = Instant::now();
if cli_arg.batch_in_time() {
info!("开始分发任务(动态 batch)");
let mut sended = vec![false; cli_arg.thread_count as usize];
loop {
// 等待一个 request work
// 大部分时间在这里等待
let latest_speed = match thread_waiter.recv() {
Ok(info) => info,
Err(_) => {
// 如果接收到了错误, 则说明所有线程都结束了, 或者怎么着出毛病了
// 退出
break;
}
};
// 遍历 sended 中 true 的部分, 检查对应 thread_running 是否为 true
for (i, sended) in sended.iter_mut().enumerate() {
if *sended {
if shared_status.thread_running[i] {
// 如果为 true, 则将对应 sended 置为 false
*sended = false;
}
}
}
// 根据 latest_speed 计算出一个合适的 batch
if latest_speed.1 == 0 {
// 如果速度为 0, 则说明刚刚开始
// 直接发送一个 1w 的 batch
let _ = work_sender.send(Some((latest_speed.0, shared_status.top_id..shared_status.top_id + 10000)));
shared_status.top_id += 10000;
} else {
// 计算出一个合适的 batch
let batch = latest_speed.1 as u64 * cli_arg.report_interval.unwrap();
// 判断是否快完事了
// 如果是, 则发送剩余的 work, 然后直接发送 None
if shared_status.top_id + batch > cli_arg.end {
let _ = work_sender.send(Some((latest_speed.0, shared_status.top_id..cli_arg.end)));
info!("最后一个 batch({}..{}) 已发送", shared_status.top_id, cli_arg.end);
loop {
let _ = thread_waiter.try_recv();
let _ = work_sender.try_send(None);
if thread.iter().all(|t| t.is_finished()) {
break;
}
}
break;
} else {
// 如果不是, 则发送一个对应线程 id 的消息
let _ = work_sender.send(Some((latest_speed.0, shared_status.top_id..shared_status.top_id + batch)));
shared_status.top_id += batch;
}
}
}
} else {
info!("开始分发任务(固定 batch)");
loop {
// 等待一个 request work
// 大部分时间在这里等待
if let Err(_) = thread_waiter.recv() {
// 如果接收到了错误, 则说明所有线程都结束了
// 退出
break;
}
// work 没分发完
// 获取第一个空闲的线程
// 这里不确定是不是会有问题, 先用 unwarp 看看
let thread_id = shared_status.get_idle_thread().unwrap();
// 先检测是否快结束了
if shared_status.top_id + cli_arg.batch_size.unwrap() as u64 >= cli_arg.end {
// 如果快结束了, 则发送剩余的 work 然后发送 None
let _ = work_sender.send(Some((thread_id as u32, shared_status.top_id..cli_arg.end)));
info!("最后一个 batch({}..{}) 已发送", shared_status.top_id, cli_arg.end);
loop {
let _ = thread_waiter.try_recv();
let _ = work_sender.try_send(None);
if thread.iter().all(|t| t.is_finished()) {
break;
}
}
break;
} else {
// 如果没有结束, 则发送一个 batch
let _ = work_sender.send(Some((
thread_id as u32,
shared_status.top_id..shared_status.top_id + cli_arg.batch_size.unwrap() as u64,
)));
}
// 更新 top_i
shared_status.top_id += cli_arg.batch_size.unwrap() as u64;
}
}
let full_end_time = Instant::now();
info!("所有任务已完成, 耗时: {:?}", full_end_time - full_start_time);
info!("各个线程获取数量: {:?}", shared_status.thread_get_count);
if shared_status.get_sum_count() != 0 {
info!(
"总计获取: {}, 效率: {}/s",
shared_status.get_sum_count(),
(shared_status.get_sum_count() as f64) / (full_end_time - full_start_time).as_secs_f64()
);
} else {
info!("这真是太悲伤了呢, 干了这么久的活, 一条数据都没获取到");
}
info!("输出文件名: {:?}", out_path);
}
/// 所有的状态输出都在子线程, 也就是这里
///
/// 1. 通过 `Receiver` 获取到主线程的数据
/// 获取到数据后, 开始计算
/// 计算完一个 batch 后, 输出一次状态
/// 这里的状态是在所有运算线程中共享的一个状态
/// 每一个线程运算完一个 batch 后, 都会更新这个状态
/// 输出的时候顺带输出其他线程的状态
pub fn cacl(
config: CacluateConfig,
status: &mut ComputeStatus,
receiver: Receiver<WorkInfo>,
work_sender: Sender<(ThreadId, u32)>,
) {
#[inline(always)]
pub fn cacl(config: CacluateConfig, id: u64, outfile: &PathBuf) {
// 初始猜测的时间间隔
let mut report_interval = 100000; // 第一次猜测测 10w 次, 获取初始数据
let mut run_speed = 0.0;
let mut start_time = std::time::Instant::now();
let mut k: u64 = 0;
let mut get_count: u32 = 0;
// 设置线程亲和性
if let Some(core_affinity) = config.core_affinity {
crate::set_thread2core(core_affinity);
crate::set_thread2core(core_affinity)
}
// 提前准备好 team_namer
let team_namer = TeamNamer::new(&config.team).unwrap();
let mut main_namer = Namer::new_from_team_namer_unchecked(&team_namer, "dummy");
let mut get_count = 0;
let mut run_speed = 0.0;
// 开始之前, 先发送一个 request
let _ = work_sender.send((config.thread_id, 0));
loop {
// 先 request 一个 work
let work = match receiver.recv() {
Ok(work) => match work {
Some(work) => {
if work.0 == config.thread_id {
work.1
} else {
// 如果不是自己的 work, 则再次发送一个 request
let _ = work_sender.send((config.thread_id, if run_speed == 0.0 { 0 } else { run_speed as u32 }));
// 然后进入下一次循环
continue;
}
}
None => {
// 如果接收到了 None, 则说明活都干完了, 退出
return;
}
},
Err(_) => {
// 如果接收到了错误, 则说明主线程已经结束了, 退出
return;
}
};
// 开始计算
let count = work.end - work.start;
let top = work.end;
let start_time = std::time::Instant::now();
// 计算
let new_get = inner_cacl(&config, work, &mut main_namer, &team_namer);
get_count += new_get;
status.add_get_count(config.thread_id, new_get);
// 完事, 统计
let now = std::time::Instant::now();
let d_t: std::time::Duration = now.duration_since(start_time);
let new_run_speed = count as f64 / d_t.as_secs_f64();
// 预估剩余时间
// 先更新自己的状态上去
status.update_speed(config.thread_id, new_run_speed as u64);
// 获取一个全局速度预测
let predict_time = status.predict_time();
debug!("{:?}", status.thread_speed);
// 输出状态
info!(
// thread_id, top, 当前线程速度, 当前batch用时, emoji, 全局速度, 全局E/d 速度, 算到几个, 进度, 预计时间
"|{:>2}|Id:{:>15}|{:6.2}E/d {:>5.2}s{}|{:>4.3}E/d|{:<3}|{:>2.3}% {}:{}:{:>2}|",
config.thread_id,
top,
new_run_speed * 8.64 / 1_0000.0,
d_t.as_secs_f64(),
// 如果速度差 1k 以上, 则输出emoji
if new_run_speed > run_speed + 1000.0 {
"".green()
} else if new_run_speed < run_speed - 1000.0 {
"".red()
} else {
"".blue()
},
status.count_speed() as f64 * 8.64 / 1_0000.0,
get_count,
(status.top_id - status.start) as f64 / (status.end - status.start) as f64 * 100.0,
predict_time.num_hours(),
predict_time.num_minutes() % 60,
predict_time.num_seconds() % 60
);
run_speed = new_run_speed;
// 然后是调度相关
status.update_running(config.thread_id, false);
// 请求一个新的 work
let _ = work_sender.send((config.thread_id, if run_speed == 0.0 { 0 } else { run_speed as u32 }));
}
}
/// 每一个 batch 的具体运算
/// 不负责状态统计
/// 状态统计的最小颗粒度是整个 batch
pub fn inner_cacl(config: &CacluateConfig, range: Range<u64>, main_namer: &mut Namer, team_namer: &TeamNamer) -> u64 {
let mut get_count = 0;
for i in range {
let mut main_namer = Namer::new_from_team_namer_unchecked(&team_namer, "看到这个说明有问题出现");
for i in config.start..config.end {
k += 1;
if k >= report_interval {
let now = std::time::Instant::now();
let d_t: std::time::Duration = now.duration_since(start_time);
let new_run_speed = k as f64 / d_t.as_secs_f64();
// 预估剩余时间
let wait_time = (config.end - i) / new_run_speed as u64;
let wait_time = chrono::Duration::seconds(wait_time as i64);
// 转换成 时:分:秒
// 根据实际运行速率来调整 report_interval
report_interval = config.report_interval * new_run_speed as u64;
info!(
"|{:>2}|Id:{:>15}|{:6.2}/s {:>3.3}E/d {:>5.2}{}|{:<3}|预计:{}:{}:{}|",
id,
i,
new_run_speed,
new_run_speed * 8.64 / 1_0000.0,
d_t.as_secs_f64(),
// 根据对比上一段运行速度 输出 emoji
// ⬆️ ➡️ ⬇️
if new_run_speed > run_speed {
"⬆️".green()
} else if new_run_speed < run_speed {
// 橙色
"⬇️".red()
} else {
"➡️".blue()
},
get_count,
wait_time.num_hours(),
wait_time.num_minutes() % 60,
wait_time.num_seconds() % 60
);
run_speed = new_run_speed;
start_time = std::time::Instant::now();
k = 0;
}
// 这堆操作放在这边了, 保证统计没问题
let name = gen_name(i);
// 新加的提前检测
if likely(!main_namer.replace_name(&team_namer, &name)) {
if !main_namer.replace_name(&team_namer, &name) {
continue;
}
// println!("{} {}", i, name);
let prop = main_namer.get_property();
if unlikely(prop > config.prop_expect as f32) {
if prop > config.prop_expect as f32 {
let name = gen_name(i);
let full_name = format!("{}@{}", name, config.team);
// 虚评
main_namer.update_skill();
let xu;
let xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(&main_namer);
let xu_qd = crate::evaluate::xuping::XuPing2_0_1015_QD::evaluate(&main_namer);
if likely((xu_qd as u32) < config.xp_expect) {
xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(&main_namer);
if likely((xu as u32) < config.xp_expect) {
continue;
}
} else {
xu = crate::evaluate::xuping::XuPing2_0_1015::evaluate(&main_namer);
if xu < config.qp_expect as f64 || xu_qd < config.qp_expect as f64 {
continue;
}
get_count += 1;
info!("Id:{:>15}|{}|{:.4}|{:.4}|{}", i, full_name, xu, xu_qd, main_namer.get_info());
// 写入文件
let write_in = format!(
// <full_name>,<id>,<xu>,<xuqd>,<main_namer.get_info()>
"{},{:>15},{:.4},{:.4},{}\n",
main_namer.get_fullname(),
full_name,
i,
xu,
xu_qd,
@ -420,15 +192,14 @@ pub fn inner_cacl(config: &CacluateConfig, range: Range<u64>, main_namer: &mut N
match std::fs::OpenOptions::new()
.append(true)
.create(true)
.open(&config.out_file)
.open(outfile)
.and_then(|mut file| file.write(write_in.as_bytes()))
{
Ok(_) => {}
Err(e) => {
warn!("写入文件<{:?}>失败: {}", config.out_file, e);
warn!("写入文件<{:?}>失败: {}", outfile, e);
}
}
}
}
get_count
}

View File

@ -4,7 +4,6 @@ pub mod xuping;
use crate::name::Namer;
/// 评价器
#[allow(unused)]
pub trait NamerEvaluater {
const NAME: &'static str;
const VERSION: &'static str;

View File

@ -1,6 +1,4 @@
#![feature(portable_simd)]
#![allow(internal_features)]
#![feature(core_intrinsics)]
#![feature(slice_swap_unchecked)]
mod cacluate;
@ -29,80 +27,57 @@ pub struct Command {
/// 八围预期值
#[arg(long = "prop-expected", short = 'p', default_value_t = 640)]
pub prop_expect: u32,
/// xp 预期值
#[arg(long = "xp-expected", short = 'x', default_value_t = 0)]
pub xp_expect: u32,
/// qp 预期值
#[arg(long = "qp-expected", short = 'q', default_value_t = 0)]
pub qp_expect: u32,
/// 队伍名称
#[arg(long)]
pub team: String,
/// 如果指定, 则根据线程的实时速度*时间为单位作为 batch 大小
#[arg(long, short = 'r')]
pub report_interval: Option<u64>,
/// 如果指定, 则使用固定的数量作为 batch 大小
#[arg(long, short = 'b')]
pub batch_size: Option<u64>,
/// 预期状态输出时间间隔 (秒)
#[arg(long, short = 'r', default_value_t = 10)]
pub report_interval: u64,
/// 单线程模式模式下的核心亲和性核心号 (从 0 开始)
#[arg(long = "core-pick")]
pub pick_core: Option<usize>,
/// 是否为 debug 模式
#[arg(long, short = 'd')]
pub debug: bool,
#[arg(long = "core-pick", default_value_t = 0)]
pub pick_core: usize,
/// 是否是子进程
#[arg(short = 's')]
pub is_sub_process: bool,
}
impl Command {
pub fn as_cacl_config(&self, path: &PathBuf) -> CacluateConfig {
pub fn as_cacl_config(&self) -> CacluateConfig {
CacluateConfig {
start: self.start,
end: self.end,
thread_id: 0,
thread_count: self.thread_count,
prop_expect: self.prop_expect,
xp_expect: self.xp_expect,
qp_expect: self.qp_expect,
team: self.team.clone(),
time_based: self.batch_in_time(),
core_affinity: self.pick_core.map(|x| 1 << x),
out_file: path.clone(),
report_interval: self.report_interval,
core_affinity: if self.thread_count == 1 { Some(1 << self.pick_core) } else { None },
}
}
pub fn is_single_thread(&self) -> bool { self.thread_count == 1 }
pub fn batch_in_time(&self) -> bool { self.report_interval.is_some() }
pub fn batch_in_count(&self) -> bool { self.batch_size.is_some() }
pub fn display_info(&self) -> String {
format!(
"开始: {} 结尾: {} 总计: {}\n线程数: {}\n八围预期: {}\n强评/强单最低值: {}\n队伍名: {}\n{}",
self.start,
self.end,
self.end - self.start,
self.thread_count,
self.prop_expect,
self.xp_expect,
self.team,
if self.batch_in_count() {
format!("固定 batch 大小: {}", self.batch_size.unwrap())
} else {
format!("时间 batch 大小: {}s", self.report_interval.unwrap())
}
)
pub fn is_single_core(&self) -> bool {
self.thread_count == 1
}
}
pub fn set_thread2core(cores: usize) {
pub fn set_thread2core(core: usize) {
#[cfg(windows)]
unsafe {
use windows_sys::Win32::System::Threading::{GetCurrentThread, SetThreadAffinityMask};
let thread_id = GetCurrentThread();
let core_mask = cores;
let core_mask = core;
match SetThreadAffinityMask(thread_id, core_mask) {
0 => warn!("设置线程亲和性 {cores} 失败 {}", std::io::Error::last_os_error()),
x => info!("设置线程亲和性 {cores} 成功 {}", x),
0 => warn!("设置线程亲和性失败 {}", std::io::Error::last_os_error()),
x => info!("设置线程亲和性成功 {}", x),
}
}
#[cfg(unix)]
{
warn!("Linux 下不支持设置线程亲和性 (未实现) {}", cores)
warn!("Linux 下不支持设置线程亲和性 (未实现) {}", core)
}
}
@ -113,8 +88,8 @@ pub fn set_process_cores(cores: usize) {
let process = GetCurrentProcess();
let core_mask = cores;
match SetProcessAffinityMask(process, core_mask) {
0 => warn!("设置进程亲和性 {cores} 失败 {}", std::io::Error::last_os_error()),
x => info!("设置进程亲和性 {cores} 成功 {}", x),
0 => warn!("设置进程亲和性失败 {}", std::io::Error::last_os_error()),
x => info!("设置进程亲和性成功 {}", x),
}
}
#[cfg(unix)]
@ -123,42 +98,9 @@ pub fn set_process_cores(cores: usize) {
}
}
pub fn set_process_priority_to_high() {
#[cfg(windows)]
unsafe {
use windows_sys::Win32::System::Threading::HIGH_PRIORITY_CLASS;
use windows_sys::Win32::System::Threading::{GetCurrentProcess, SetPriorityClass};
let process = GetCurrentProcess();
match SetPriorityClass(process, HIGH_PRIORITY_CLASS) {
0 => warn!("设置进程优先级为高失败 {}", std::io::Error::last_os_error()),
_ => info!("设置进程优先级为高成功"),
}
}
#[cfg(unix)]
{
warn!("Linux 下不支持设置进程优先级为高 (未实现)")
}
}
fn main() {
tracing_subscriber::fmt().with_max_level(tracing::Level::DEBUG).init();
let mut cli_arg = Command::parse();
tracing_subscriber::fmt()
.with_max_level(if cli_arg.debug {
tracing::Level::DEBUG
} else {
tracing::Level::INFO
})
.init();
// 先验证参数
// batch 至少要是 size 或者 count 之一
if !cli_arg.batch_in_count() && !cli_arg.batch_in_time() {
warn!("必须指定 batch 大小, 请使用 -r 或者 -b 选项");
return;
}
// 如果俩都指定了, 则使用时间为准
if cli_arg.batch_in_count() && cli_arg.batch_in_time() {
warn!("两个 batch 选项都指定了, 将使用时间为准");
}
// 将数据量处理成可被 thread_count 整除
let left = cli_arg.start % cli_arg.thread_count as u64;
@ -176,7 +118,13 @@ fn main() {
return;
}
info!("{}", cli_arg.display_info());
set_process_priority_to_high();
info!("开始: {} 结尾: {}", cli_arg.start, cli_arg.end);
info!("线程数: {}", cli_arg.thread_count);
info!("八围预期: {}", cli_arg.prop_expect);
info!("队伍名: {}", cli_arg.team);
info!("输出文件名: {:?}", out_path);
info!("预期状态输出时间间隔: {} 秒", cli_arg.report_interval);
cacluate::start_main(cli_arg, out_path);
}

View File

@ -453,6 +453,7 @@ impl Namer {
+ *prop_name.get_unchecked(6) as u32;
full += self.name_prop.get_unchecked(0) / 3 + 154;
if full < 380 {
println!("name_prop[0] < 380 {}", self.name);
return false;
}
}
@ -533,65 +534,26 @@ impl Namer {
unsafe {
if p > 10 && *self.skl_id.get_unchecked(j) < 35 {
*self.skl_freq.get_unchecked_mut(j) = p - 10;
if p < 35 {
last = j as i8;
if *self.skl_id.get_unchecked(j) < 25 {
last = j as i32;
}
} else {
*self.skl_freq.get_unchecked_mut(j) = 0;
}
}
}
match last {
-1 => unsafe {
// 判断 14, 15 去
if *self.skl_freq.get_unchecked(14) != 0 {
*self.skl_freq.get_unchecked_mut(14) += min(
min(*self.name_base.get_unchecked(60), *self.name_base.get_unchecked(61)),
*self.skl_freq.get_unchecked(14),
)
}
if *self.skl_freq.get_unchecked(15) != 0 {
*self.skl_freq.get_unchecked_mut(15) += min(
min(*self.name_base.get_unchecked(62), *self.name_base.get_unchecked(63)),
*self.skl_freq.get_unchecked(15),
)
}
},
14 => unsafe {
// 判断 15
*self.skl_freq.get_unchecked_mut(14) <<= 1;
if *self.skl_freq.get_unchecked(15) != 0 {
*self.skl_freq.get_unchecked_mut(15) += min(
min(*self.name_base.get_unchecked(62), *self.name_base.get_unchecked(63)),
*self.skl_freq.get_unchecked(15),
)
}
},
15 => unsafe {
// 判断 14
*self.skl_freq.get_unchecked_mut(15) <<= 1;
if *self.skl_freq.get_unchecked(14) != 0 {
*self.skl_freq.get_unchecked_mut(14) += min(
min(*self.name_base.get_unchecked(60), *self.name_base.get_unchecked(61)),
*self.skl_freq.get_unchecked(14),
)
}
},
x => unsafe {
*self.skl_freq.get_unchecked_mut(x as usize) <<= 1;
if *self.skl_freq.get_unchecked(14) != 0 {
*self.skl_freq.get_unchecked_mut(14) += min(
min(*self.name_base.get_unchecked(60), *self.name_base.get_unchecked(61)),
*self.skl_freq.get_unchecked(14),
)
}
if *self.skl_freq.get_unchecked(15) != 0 {
*self.skl_freq.get_unchecked_mut(15) += min(
min(*self.name_base.get_unchecked(62), *self.name_base.get_unchecked(63)),
*self.skl_freq.get_unchecked(15),
)
}
},
if last != -1 {
// self.skl_freq[last as usize] <<= 1;
unsafe {
*self.skl_freq.get_unchecked_mut(last as usize) <<= 1;
}
// *= 2
}
if (self.skl_freq[14] != 0) && (last != 14) {
self.skl_freq[14] += min(min(self.name_base[60], self.name_base[61]), self.skl_freq[14]);
}
if (self.skl_freq[15] != 0) && (last != 15) {
self.skl_freq[15] += min(min(self.name_base[62], self.name_base[63]), self.skl_freq[15]);
}
}
@ -687,7 +649,11 @@ impl Namer {
}
pub fn get_fullname(&self) -> String {
format!("{}@{}", self.name, if self.team.is_empty() { &self.name } else { &self.team })
if self.team.is_empty() {
self.name.clone()
} else {
format!("{}@{}", self.name, self.team)
}
}
}
@ -797,10 +763,10 @@ mod test {
fn update_name_test() {
// 先创建一个正常的 namer
// 然后更新名字
let team = TeamNamer::new_unchecked("shenjack");
let team = TeamNamer::new_unchecked("x");
let mut namer = Namer::new_from_team_namer_unchecked(&team, "x");
let update_name = "一一一丑堀㴁";
let update_name = "k";
namer.replace_name(&team, update_name);
let mut none_update_name = Namer::new_from_team_namer_unchecked(&team, update_name);

View File

@ -1,39 +0,0 @@
#![feature(portable_simd)]
#![feature(slice_swap_unchecked)]
#![allow(internal_features)]
#![feature(core_intrinsics)]
mod evaluate;
mod name;
use std::env;
use evaluate::NamerEvaluater;
fn main() {
// 获取 cli 参数
let arg = env::args().nth(1).expect("need a name to evaluate");
if arg == "-f" {
let arg = env::args().nth(2).expect("need a file to evaluate");
let file = std::fs::read_to_string(arg).expect("file not found");
let names = file.lines().collect::<Vec<_>>();
for name in names {
let mut name = name::Namer::new(&name.to_string()).expect("your name have some thing wrong");
name.update_skill();
let xu = evaluate::xuping::XuPing2_0_1015::evaluate(&name);
let xd = evaluate::xuping::XuPing2_0_1015_QD::evaluate(&name);
println!("{xu}|{xd}")
}
return;
} else if arg == "-h" {
println!("Usage: xp_eval [name]");
println!(" xp_eval -f [file]");
return;
}
let mut name = name::Namer::new(&arg).expect("your name have some thing wrong");
name.update_skill();
let xu = evaluate::xuping::XuPing2_0_1015::evaluate(&name);
let xd = evaluate::xuping::XuPing2_0_1015_QD::evaluate(&name);
println!("{xu}\n{xd}")
}

16
news.md
View File

@ -1,3 +1,19 @@
# 各种"新闻"
## tswn
### 0.1.3
> 550E/d
夸张, 比 0.1.1 快了 100E/d
### 0.1.2
优化了一些边界检查, 反正就是没用
`445E/d -> 478E/d`
参考 bench/tswn.md
### 0.1.1
随手发一版

View File

@ -1,8 +0,0 @@
model_version = "0.0.0"
# 整体逻辑
#
# 八围(8) + 技能(35) + 血祭/分身/幻术/亡灵 技能最大值的八围(8)
# == 51
# 每个数来回乘一遍 == 51*51 == 2601
# 参数 = 2601
# 也就是 本名 / ?summon / ?zombie / ?shadow