diff --git a/Cargo.lock b/Cargo.lock index 16f47ee..a733aab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,314 +2,432 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.6" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5e63fd144e18ba274ae7095c0197a870a7b9468abc801dd62f190d80817d2ec" dependencies = [ - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi", ] +[[package]] +name = "anyhow" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c" + [[package]] name = "atty" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "hermit-abi", + "libc", + "winapi", ] [[package]] name = "autocfg" -version = "0.1.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "cargo-profiler" -version = "0.2.0" +version = "1.1.0" dependencies = [ - "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ndarray 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "anyhow", + "clap", + "lazy_static", + "ndarray", + "regex", + "serde", + "serde_json", + "structopt", + "strum", + "strum_macros", ] [[package]] name = "clap" version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "either" version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" + +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" +dependencies = [ + "libc", +] [[package]] name = "itertools" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "itoa" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.65" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" [[package]] name = "matrixmultiply" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f" dependencies = [ - "rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rawpointer", ] [[package]] name = "memchr" -version = "2.2.1" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "ndarray" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b001fc2f5df269365fb77bd8396ce6b1f61c9848f7f088c25e57494bacc57b" dependencies = [ - "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools", + "matrixmultiply", + "num-complex", + "num-integer", + "num-traits", + "rawpointer", ] [[package]] name = "num-complex" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-integer" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" -version = "0.2.8" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro-error" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a857f7c61b149c868eb7e40311b48502fcc924744fb73191962748643336568" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "075d00534b62f176b55a48b68319be2f3fc05616d68ecd2bcb66bac0a49170e1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "syn-mid", + "version_check", ] [[package]] name = "proc-macro2" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid", ] [[package]] name = "quote" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rawpointer" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "regex" -version = "1.3.1" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" dependencies = [ - "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", ] [[package]] name = "regex-syntax" -version = "0.6.12" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" [[package]] name = "ryu" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" [[package]] name = "serde" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" dependencies = [ - "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "serde_json" -version = "1.0.41" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9371ade75d4c2d6cb154141b9752cf3781ec9c05e0e5cf35060e1e70ee7b9c25" dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "structopt" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1bcbed7d48956fcbb5d80c6b95aedb553513de0a1b451ea92679d999c010e98" +dependencies = [ + "clap", + "lazy_static", + "structopt-derive", +] + +[[package]] +name = "structopt-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "095064aa1f5b94d14e635d0a5684cf140c43ae40a0fd990708d38f5d669e5f64" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "strum" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6138f8f88a16d90134763314e3fc76fa3ed6a7db4725d6acf9a3ef95a3188d22" + +[[package]] +name = "strum_macros" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] [[package]] name = "syn" -version = "1.0.7" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "syn-mid" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "thread_local" -version = "0.3.6" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" dependencies = [ - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", ] +[[package]] +name = "unicode-segmentation" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" + [[package]] name = "unicode-width" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" [[package]] name = "unicode-xid" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" [[package]] name = "vec_map" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" + +[[package]] +name = "version_check" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" [[package]] name = "winapi" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" -"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" -"checksum itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87fa75c9dea7b07be3138c49abbb83fd4bea199b5cdc76f9804458edc5da0d6e" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" -"checksum matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f" -"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" -"checksum ndarray 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25b001fc2f5df269365fb77bd8396ce6b1f61c9848f7f088c25e57494bacc57b" -"checksum num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fcb0cf31fb3ff77e6d2a6ebd6800df7fdcd106f2ad89113c9130bcd07f93dffc" -"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" -"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" -"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" -"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" -"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" -"checksum serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4b39bd9b0b087684013a792c59e3e07a46a01d2322518d8a1104641a0b1be0" -"checksum serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "ca13fc1a832f793322228923fbb3aba9f3f44444898f835d31ad1b74fa0a2bf8" -"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7bedb3320d0f3035594b0b723c8a28d7d336a3eda3881db79e61d676fb644c" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index cb396f2..eb6c7cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-profiler" -version = "0.2.0" +version = "1.1.0" authors = ["pegasos1", "Sven-Hendrik Haase "] description = "Cargo subcommand to profile your applications." homepage = "http://github.com/svenstaro/cargo-profiler" @@ -16,3 +16,7 @@ ndarray = "0.13" lazy_static = "1" serde = { version = "1", features = ["derive"] } serde_json = "1" +structopt = "0.3" +anyhow = "1" +strum = "0.16" +strum_macros = "0.16" diff --git a/src/argparse.rs b/src/argparse.rs index 54b6fd8..7945e07 100644 --- a/src/argparse.rs +++ b/src/argparse.rs @@ -34,15 +34,6 @@ pub fn get_binary<'a>(matches: &'a ArgMatches) -> Result<&'a str, ProfError> { } } -/// parse the number argument into a usize -pub fn get_num(matches: &ArgMatches) -> Result { - match matches.value_of("n").map(|x| x.parse::()) { - Some(Ok(z)) => Ok(z), - Some(Err(_)) => Err(ProfError::InvalidNum), - None => Ok(10000), // some arbitrarily large number... - } -} - /// get the cachegrind metric user wants to sort on pub fn get_sort_metric(matches: &ArgMatches) -> Result { match matches.value_of("sort") { @@ -73,11 +64,6 @@ mod test { assert_eq!(1, 1); } - #[test] - fn test_get_num() { - assert_eq!(1, 1); - } - #[test] fn test_get_sort_metric() { assert_eq!(1, 1); diff --git a/src/args.rs b/src/args.rs new file mode 100644 index 0000000..fe41e94 --- /dev/null +++ b/src/args.rs @@ -0,0 +1,68 @@ +use structopt::StructOpt; +use crate::parse::cachegrind::Metric; + +#[derive(Debug, Clone, StructOpt)] +#[structopt( + name = "cargo-profiler", + author, + about, + global_settings = &[structopt::clap::AppSettings::ColoredHelp] +)] +pub enum CargoProfilerConfig { + Profiler { + #[structopt(subcommand)] + profiler_type: ProfilerType, + } +} + +#[derive(Debug, Clone, StructOpt)] +pub enum ProfilerType { + /// Run callgrind + Callgrind { + /// Binary you want to profile + #[structopt(name = "BIN", long)] + binary_name: String, + + /// Arguments for the binary + #[structopt(name = "ARG")] + binary_args: Vec, + + /// Build binary in release mode + #[structopt(long)] + release: bool, + + /// Number of functions you want + #[structopt(short, default_value = "10000")] + n_functions: u16, + + /// Keep profiler output files + #[structopt(short, long)] + keep: bool, + }, + /// Run cachegrind + Cachegrind { + /// Binary you want to profile + #[structopt(name = "BIN", long)] + binary_name: String, + + /// Arguments for the binary + #[structopt(name = "ARG")] + binary_args: Vec, + + /// Build binary in release mode + #[structopt(long)] + release: bool, + + /// Number of functions you want + #[structopt(short, default_value = "10000")] + n_functions: u16, + + /// Metric you want to sort by + #[structopt(short, long, default_value = "NAN")] + sort: Metric, + + /// Keep profiler output files + #[structopt(short, long)] + keep: bool, + }, +} diff --git a/src/display.rs b/src/display.rs index 775d06f..b456734 100644 --- a/src/display.rs +++ b/src/display.rs @@ -40,7 +40,7 @@ fn fmt_thousands_sep(n: f64, sep: char) -> String { impl fmt::Display for Profiler { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - Profiler::CacheGrind { + Profiler::Cachegrind { ref ir, ref i1mr, ref ilmr, @@ -100,7 +100,7 @@ impl fmt::Display for Profiler { Ok(()) } - Profiler::CallGrind { + Profiler::Callgrind { ref total_instructions, ref instructions, ref functs, diff --git a/src/main.rs b/src/main.rs index df625e0..5584333 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,178 +1,92 @@ pub mod argparse; +pub mod args; pub mod cargo; pub mod display; pub mod err; pub mod parse; pub mod profiler; -use crate::argparse::{get_binary, get_num, get_profiler, get_sort_metric}; +use crate::argparse::{get_binary, get_profiler, get_sort_metric}; use crate::cargo::build_binary; use crate::err::ProfError; -use crate::parse::cachegrind::CacheGrindParser; -use crate::parse::callgrind::CallGrindParser; -use crate::profiler::Profiler; +use crate::parse::cachegrind::CachegrindParser; +use crate::parse::callgrind::CallgrindParser; +use crate::args::ProfilerType; use clap::{App, AppSettings, Arg, SubCommand}; use std::ffi::OsStr; use std::process; use std::process::Command; - -// macro to try something, but print custom error message and exit upon error. -macro_rules! try_or_exit { - ($e:expr) => { - match $e { - Ok(e) => e, - Err(e) => { - println!("{}", e); - process::exit(1); - } - } - }; -} - -fn main() { - let _ = real_main(); -} - -// #[cfg(all(unix, any(target_os = "linux", target_os = "macos")))] -#[cfg(unix)] -fn real_main() -> Result<(), ProfError> { - // create binary path argument - let binary_arg = Arg::with_name("binary") - .long("bin") - .value_name("BINARY") - .required(false) - .help("binary you want to profile"); - - // create binary arguments positional args (aka, everything after a '--') - let binargs_arg = Arg::with_name("binargs") - .multiple(true) - .value_name("BIN_ARGS") - .required(false) - .help("arguments to the binary when executed"); - - // create release argument - let release = Arg::with_name("release") - .long("release") - .required(false) - .help("whether binary should be built in release mode"); - - // create function count argument - let fn_count_arg = Arg::with_name("n") - .short("n") - .value_name("NUMBER") - .takes_value(true) - .help("number of functions you want"); - - // create sort metric argument - let sort_arg = Arg::with_name("sort") - .long("sort") - .value_name("SORT") - .takes_value(true) - .help("metric you want to sort by"); - - // keep output files - let keep_arg = Arg::with_name("keep") - .long("keep") - .required(false) - .help("keep profiler output files"); - - - // create callgrind subcommand - let callgrind = SubCommand::with_name("callgrind") - .about("gets callgrind features") - .version("1.0") - .author("Suchin Gururangan") - .arg(release.clone()) - .arg(binary_arg.clone()) - .arg(binargs_arg.clone()) - .arg(fn_count_arg.clone()) - .arg(keep_arg.clone()); - - // create cachegrind subcommand - let cachegrind = SubCommand::with_name("cachegrind") - .about("gets cachegrind features") - .version("1.0") - .author("Suchin Gururangan") - .arg(release) - .arg(binary_arg) - .arg(binargs_arg.clone()) - .arg(fn_count_arg) - .arg(sort_arg) - .arg(keep_arg); - - // create profiler subcommand - let profiler = SubCommand::with_name("profiler") - .about("gets callgrind features") - .version("1.0") - .author("Suchin Gururangan") - .subcommand(callgrind) - .subcommand(cachegrind); - - // create profiler application - let matches = App::new("cargo-profiler") - .bin_name("cargo") - .settings(&[AppSettings::SubcommandRequired]) - .version("1.0") - .author("Suchin Gururangan") - .about("Profile your binaries") - .subcommand(profiler) - .get_matches(); - - // parse arguments from cli call - let (m, profiler) = try_or_exit!(get_profiler(&matches)); - let binary = { - if m.is_present("binary") { - try_or_exit!(get_binary(&m)).to_string() - } else if m.is_present("release") { - try_or_exit!(build_binary(true)) - } else { - try_or_exit!(build_binary(false)) - } +use structopt::StructOpt; +use anyhow::Result; + +fn main() -> Result<()> { + let args = args::CargoProfilerConfig::from_args(); + + // The way cargo extension programs are meant to be written requires us to always have a + // variant here that is the only one that'll ever be usd. + let profiler_type = if let args::CargoProfilerConfig::Profiler { profiler_type } = args { + profiler_type + } else { + unreachable!(); }; - let binary_name = binary.split('/').collect::>().pop().unwrap_or(""); - let binargs: Vec<&OsStr> = match m.values_of_os("binargs") { - None => vec![], - Some(raw) => raw.collect(), - }; - - let num = try_or_exit!(get_num(&m)); - let sort_metric = try_or_exit!(get_sort_metric(&m)); - - match profiler { - Profiler::CallGrind { .. } => println!( + match profiler_type { + ProfilerType::Callgrind { binary_name, .. } => println!( "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith callgrind\x1b[0m...", binary_name ), - Profiler::CacheGrind { .. } => println!( + ProfilerType::Cachegrind { binary_name, .. } => println!( "\n\x1b[1;33mProfiling \x1b[1;0m{} \x1b[0mwith cachegrind\x1b[0m...", binary_name ), }; - // get the profiler output - let output = match profiler { - Profiler::CallGrind { .. } => profiler.callgrind_cli(&binary, &binargs)?, - Profiler::CacheGrind { .. } => profiler.cachegrind_cli(&binary, &binargs)?, - }; - - // parse the output into struct - let parsed = match profiler { - Profiler::CallGrind { .. } => try_or_exit!(profiler.callgrind_parse(&output, num)), - Profiler::CacheGrind { .. } => { - try_or_exit!(profiler.cachegrind_parse(&output, num, sort_metric)) - } - }; - - // pretty-print - println!("{}", parsed); - - if !m.is_present("keep") { - // remove files generated while profiling - Command::new("rm").arg("cachegrind.out").output()?; - - Command::new("rm").arg("callgrind.out").output()?; - } + // // parse arguments from cli call + // let (m, profiler) = try_or_exit!(get_profiler(&matches)); + // let binary = { + // if m.is_present("binary") { + // try_or_exit!(get_binary(&m)).to_string() + // } else if m.is_present("release") { + // try_or_exit!(build_binary(true)) + // } else { + // try_or_exit!(build_binary(false)) + // } + // }; + // + // let binary_name = binary.split('/').collect::>().pop().unwrap_or(""); + // let binargs: Vec<&OsStr> = match m.values_of_os("binargs") { + // None => vec![], + // Some(raw) => raw.collect(), + // }; + // + // let num = try_or_exit!(get_num(&m)); + // let sort_metric = try_or_exit!(get_sort_metric(&m)); + // + // + // // get the profiler output + // let output = match profiler { + // Profiler::CallGrind { .. } => profiler.callgrind_cli(&binary, &binargs)?, + // Profiler::CacheGrind { .. } => profiler.cachegrind_cli(&binary, &binargs)?, + // }; + // + // // parse the output into struct + // let parsed = match profiler { + // Profiler::CallGrind { .. } => try_or_exit!(profiler.callgrind_parse(&output, num)), + // Profiler::CacheGrind { .. } => { + // try_or_exit!(profiler.cachegrind_parse(&output, num, sort_metric)) + // } + // }; + // + // + // + // // pretty-print + // println!("{}", parsed); + // + // if !args.keep { + // // remove files generated while profiling + // Command::new("rm").arg("cachegrind.out").output()?; + // Command::new("rm").arg("callgrind.out").output()?; + // } Ok(()) } diff --git a/src/parse/cachegrind.rs b/src/parse/cachegrind.rs index feaf52d..24301c1 100644 --- a/src/parse/cachegrind.rs +++ b/src/parse/cachegrind.rs @@ -6,8 +6,10 @@ use regex::Regex; use std::cmp::Ordering::Less; use std::ffi::OsStr; use std::process::Command; +use strum_macros::EnumString; /// define cachegrind metrics +#[derive(Debug, Clone, EnumString)] pub enum Metric { Ir, I1mr, @@ -31,7 +33,7 @@ pub fn sort_matrix(mat: &Array2, sort_col: ArrayView1) -> (Array2 /// Parser trait. To parse the output of Profilers, we first have to get their output from /// the command line, and then parse the output into respective structs. -pub trait CacheGrindParser { +pub trait CachegrindParser { fn cachegrind_cli(&self, binary: &str, binargs: &[&OsStr]) -> Result; fn cachegrind_parse<'b>( &'b self, @@ -41,7 +43,7 @@ pub trait CacheGrindParser { ) -> Result; } -impl CacheGrindParser for Profiler { +impl CachegrindParser for Profiler { /// Get profiler output from stdout. fn cachegrind_cli(&self, binary: &str, binargs: &[&OsStr]) -> Result { // get cachegrind cli output from stdout @@ -196,7 +198,7 @@ impl CacheGrindParser for Profiler { } // put all data in cachegrind struct! - Ok(Profiler::CacheGrind { + Ok(Profiler::Cachegrind { ir, i1mr, ilmr, diff --git a/src/parse/callgrind.rs b/src/parse/callgrind.rs index 88315ce..64211ab 100644 --- a/src/parse/callgrind.rs +++ b/src/parse/callgrind.rs @@ -7,12 +7,12 @@ use std::process::Command; // Parser trait. To parse the output of Profilers, we first have to get their output from // the command line, and then parse the output into respective structs. -pub trait CallGrindParser { +pub trait CallgrindParser { fn callgrind_cli(&self, binary: &str, binargs: &[&OsStr]) -> Result; fn callgrind_parse<'b>(&'b self, output: &'b str, num: usize) -> Result; } -impl CallGrindParser for Profiler { +impl CallgrindParser for Profiler { // Get profiler output from stdout. fn callgrind_cli(&self, binary: &str, binargs: &[&OsStr]) -> Result { // get callgrind cli output from stdout @@ -98,7 +98,7 @@ impl CallGrindParser for Profiler { funcs = funcs.iter().take(num).cloned().collect(); } // put all data in cachegrind struct! - Ok(Profiler::CallGrind { + Ok(Profiler::Callgrind { total_instructions, instructions: data_vec, functs: funcs, @@ -108,7 +108,7 @@ impl CallGrindParser for Profiler { #[cfg(test)] mod test { - use super::CallGrindParser; + use super::CallgrindParser; use crate::profiler::Profiler; #[test] fn test_callgrind_parse_1() { diff --git a/src/profiler.rs b/src/profiler.rs index 58134a0..39ff417 100644 --- a/src/profiler.rs +++ b/src/profiler.rs @@ -1,12 +1,12 @@ use ndarray::Array2; use std::f64; -// Profiler enum. We have two profilers: CacheGrind and CallGrind. +// Profiler enum. We have two profilers: Cachegrind and Callgrind. pub enum Profiler { - // CachGrind holds the parsed objects of + // Cachgrind holds the parsed objects of // `valgrind --tool=cachegrind -cachegrind-out-file=cachegrind.out // && cg_annotate cachegrind.out` - CacheGrind { + Cachegrind { ir: f64, i1mr: f64, ilmr: f64, @@ -23,7 +23,7 @@ pub enum Profiler { // Call holds the parsed objects of // `valgrind --tool=callgrind --callgrind-out-file=callgrind.out // && callgrind_annotate callgrind.out` - CallGrind { + Callgrind { total_instructions: f64, instructions: Vec, functs: Vec, @@ -32,10 +32,10 @@ pub enum Profiler { // Initialize the Profilers impl Profiler { - // Initialize CacheGrind + // Initialize Cachegrind pub fn new_cachegrind() -> Profiler { - Profiler::CacheGrind { + Profiler::Cachegrind { // total instructions ir: f64::NAN, // total instruction-cache read misses @@ -60,9 +60,9 @@ impl Profiler { functs: Vec::new(), } } - // Initialize CallGrind + // Initialize Callgrind pub fn new_callgrind() -> Profiler { - Profiler::CallGrind { + Profiler::Callgrind { // total instruction calls total_instructions: f64::NAN, // instruction data