diff --git a/Cargo.lock b/Cargo.lock index f35b9797..852f055c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,11 +4,11 @@ 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 0.29.0", + "gimli 0.28.1", ] [[package]] @@ -95,9 +95,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys 0.52.0", ] @@ -118,6 +118,12 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "array-init" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc" + [[package]] name = "arrayvec" version = "0.7.4" @@ -136,9 +142,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.11" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd066d0b4ef8ecb03a55319dc13aa6910616d0f44008a045bb1835af830abff5" +checksum = "9c90a406b4495d129f00461241616194cb8a032c8d1c53c657f0961d5f8e0498" dependencies = [ "brotli", "flate2", @@ -149,12 +155,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.3.0" @@ -163,16 +163,16 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[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 0.22.0", + "addr2line 0.21.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.32.2", "rustc-demangle", ] @@ -204,6 +204,30 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597bb81c80a54b6a4381b23faba8d7774b144c94cbd1d6fe3f1329bd776554ab" +[[package]] +name = "binrw" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173901312e9850391d4d7c1318c4e099fdc037d61870fca427429830efdb4e5f" +dependencies = [ + "array-init", + "binrw_derive", + "bytemuck", +] + +[[package]] +name = "binrw_derive" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb515fdd6f8d3a357c8e19b8ec59ef53880807864329b1cb1cba5c53bf76557e" +dependencies = [ + "either", + "owo-colors", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -212,9 +236,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bitvec" @@ -241,9 +265,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "4.0.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +checksum = "e6221fe77a248b9117d431ad93761222e1cf8ff282d9d1d5d9f53d6299a1cf76" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -266,6 +290,12 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "bytemuck" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" + [[package]] name = "byteorder" version = "1.5.0" @@ -319,9 +349,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.101" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac367972e516d45567c7eafc73d24e1c193dcf200a8d94e9db7b3d38b349572d" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" [[package]] name = "cfg-if" @@ -372,14 +402,14 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[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 = "colorchoice" @@ -403,6 +433,18 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "coreclr-tracing" +version = "0.1.0" +dependencies = [ + "binrw", + "bitflags 2.5.0", + "etw-reader", + "log", + "num-derive", + "num-traits", +] + [[package]] name = "cpp_demangle" version = "0.4.3" @@ -429,9 +471,9 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -447,9 +489,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "ctrlc" @@ -534,9 +576,9 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "elsa" @@ -556,7 +598,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -602,7 +644,7 @@ dependencies = [ name = "etw-reader" version = "0.1.0" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "fxhash", "memoffset", "num-derive", @@ -676,9 +718,9 @@ dependencies = [ [[package]] name = "fs4" -version = "0.8.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e180ac76c23b45e767bd7ae9579bc0bb458618c4bc71835926e098e61d15f8" +checksum = "73969b81e8bc90a3828d913dd3973d80771bfb9d7fbe1a78a79122aad456af15" dependencies = [ "rustix", "windows-sys 0.52.0", @@ -746,7 +788,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -793,7 +835,7 @@ name = "fxprof-processed-profile" version = "0.7.0" dependencies = [ "assert-json-diff", - "bitflags 2.6.0", + "bitflags 2.5.0", "debugid", "fxhash", "serde", @@ -825,9 +867,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 = "gimli" @@ -841,15 +883,15 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" dependencies = [ - "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", + "futures-util", "http", "indexmap", "slab", @@ -917,12 +959,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", - "futures-util", + "futures-core", "http", "http-body", "pin-project-lite", @@ -930,9 +972,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" @@ -969,9 +1011,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", "http", @@ -982,7 +1024,6 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "webpki-roots", ] [[package]] @@ -1088,7 +1129,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "libc", ] @@ -1100,9 +1141,9 @@ checksum = "bfae20f6b19ad527b550c223fddc3077a547fc70cda94b9b566575423fd303ee" [[package]] name = "linux-perf-data" -version = "0.10.2" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd34317b7ef6e67579faf5021099ff15faa873a082e8b2c46335acbd7147935" +checksum = "ab6ca5ed6c97474bb07087546ab4201772868214e25d7dc15fe7a9900b70ad67" dependencies = [ "byteorder", "linear-map", @@ -1119,7 +1160,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41064623ecf100db029bd29e4a1cdec25fc513d45c15619ecd03504e2ffb1687" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "byteorder", "memchr", "thiserror", @@ -1127,9 +1168,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -1143,9 +1184,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lzma-rs" @@ -1191,9 +1232,9 @@ checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" [[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 = "memmap2" @@ -1227,9 +1268,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[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", ] @@ -1252,7 +1293,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4c25a3bb7d880e8eceab4822f3141ad0700d20f025991c1f03bd3d00219a5fc" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", ] [[package]] @@ -1261,7 +1302,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "cfg-if", "cfg_aliases 0.1.1", "libc", @@ -1273,7 +1314,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "cfg-if", "cfg_aliases 0.2.1", "libc", @@ -1318,7 +1359,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -1340,6 +1381,15 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + [[package]] name = "object" version = "0.36.1" @@ -1386,11 +1436,17 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -1404,7 +1460,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.2", + "redox_syscall 0.5.1", "smallvec", "windows-targets 0.52.6", ] @@ -1415,7 +1471,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb51ef7ed9998e108891711812822831daac0b17d67768c3bdc69aa909366123" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "elsa", "maybe-owned", "pdb2", @@ -1439,7 +1495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ec3b43050c38ffb9de87e17d874e9956e3a9131b343c9b7b7002597727c3891" dependencies = [ "arrayvec", - "bitflags 2.6.0", + "bitflags 2.5.0", "thiserror", "zerocopy", "zerocopy-derive", @@ -1468,7 +1524,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -1525,33 +1581,33 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.12.6" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", ] [[package]] name = "prost-derive" -version = "0.12.6" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -1575,53 +1631,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "quinn" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" -dependencies = [ - "bytes", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash 1.1.0", - "rustls", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "quinn-proto" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" -dependencies = [ - "bytes", - "rand", - "ring", - "rustc-hash 2.0.0", - "rustls", - "slab", - "thiserror", - "tinyvec", - "tracing", -] - -[[package]] -name = "quinn-udp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" -dependencies = [ - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.52.0", -] - [[package]] name = "quote" version = "1.0.36" @@ -1696,11 +1705,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", ] [[package]] @@ -1731,14 +1740,14 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[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", @@ -1748,9 +1757,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", @@ -1759,15 +1768,15 @@ 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 = "reqwest" -version = "0.12.5" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ "async-compression", "base64", @@ -1788,7 +1797,6 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "quinn", "rustls", "rustls-pemfile", "rustls-pki-types", @@ -1842,25 +1850,13 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hash" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" - [[package]] name = "rustix" version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -1869,11 +1865,11 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.10" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ - "once_cell", + "log", "ring", "rustls-pki-types", "rustls-webpki", @@ -1957,7 +1953,7 @@ version = "0.23.0" dependencies = [ "addr2line 0.23.0", "anyhow", - "bitflags 2.6.0", + "bitflags 2.5.0", "bitvec", "bytesize", "cpp_demangle", @@ -1973,7 +1969,7 @@ dependencies = [ "memmap2", "msvc-demangler", "nom", - "object", + "object 0.36.1", "pdb-addr2line", "rangemap", "rustc-demangle", @@ -2032,7 +2028,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -2125,15 +2121,15 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.6.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "symsrv" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9eb3fb03ab32475d1107c2b3d2efcd48cb5e9278e7b39186598df7a049a1da" +checksum = "098492916b4954d05c9f195d073714401a48ad9d0c1d4690a4074146c9924804" dependencies = [ "async-compression", "cab", @@ -2149,9 +2145,20 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f" dependencies = [ "proc-macro2", "quote", @@ -2160,9 +2167,9 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "synstructure" @@ -2172,7 +2179,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -2181,7 +2188,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7dddc5f0fee506baf8b9fdb989e242f17e4b11c61dfbb0635b705217199eea" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "byteorder", "enum-as-inner", "libc", @@ -2220,22 +2227,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -2271,9 +2278,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -2286,9 +2293,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" dependencies = [ "backtrace", "bytes", @@ -2309,14 +2316,14 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ "rustls", "rustls-pki-types", @@ -2370,21 +2377,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tracing-core" version = "0.1.32" @@ -2448,9 +2443,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", @@ -2459,12 +2454,13 @@ dependencies = [ [[package]] name = "usamply" -version = "0.12.9" +version = "0.12.10-prerelease.5" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.5.0", "byteorder", "cfg-if", "clap", + "coreclr-tracing", "crossbeam-channel", "ctrlc", "debugid", @@ -2494,7 +2490,7 @@ dependencies = [ "num-derive", "num-traits", "num_cpus", - "object", + "object 0.36.1", "once_cell", "opener", "os-release", @@ -2524,9 +2520,9 @@ dependencies = [ [[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 = "uuid" @@ -2589,7 +2585,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.64", "wasm-bindgen-shared", ] @@ -2623,7 +2619,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2659,9 +2655,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.3" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" dependencies = [ "rustls-pki-types", ] @@ -2789,7 +2785,7 @@ checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6" dependencies = [ "windows-implement 0.56.0", "windows-interface 0.56.0", - "windows-result 0.1.2", + "windows-result 0.1.1", "windows-targets 0.52.6", ] @@ -2814,7 +2810,7 @@ checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -2825,7 +2821,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -2836,7 +2832,7 @@ checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] @@ -2847,14 +2843,14 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] name = "windows-result" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b" dependencies = [ "windows-targets 0.52.6", ] @@ -3094,9 +3090,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +checksum = "65e71b2e4f287f467794c671e2b8f8a5f3716b3c829079a1c44740148eff07e4" dependencies = [ "serde", "stable_deref_trait", @@ -3105,21 +3101,21 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +checksum = "9e6936f0cce458098a201c245a11bef556c6a0181129c7034d10d76d1ec3a2b8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", "synstructure", ] [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "byteorder", "zerocopy-derive", @@ -3127,23 +3123,23 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.64", ] [[package]] name = "zerofrom" -version = "0.1.4" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +checksum = "655b0814c5c0b19ade497851070c640773304939a6c0fd5f5fb43da0696d05b7" [[package]] name = "zeroize" -version = "1.8.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index 77d3cb00..0ac0c0b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,8 @@ members = [ "wholesym-addr2line", "tools/benchmarks", "tools/dump_table", - "tools/query_api" + "tools/query_api", + "coreclr-tracing" ] exclude = ["etw-reader"] # Should not be compiled on non-Windows diff --git a/coreclr-tracing/Cargo.toml b/coreclr-tracing/Cargo.toml new file mode 100644 index 00000000..5f739dcf --- /dev/null +++ b/coreclr-tracing/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "coreclr-tracing" +version = "0.1.0" +edition = "2021" + +[dependencies] +binrw = "0.13.3" +bitflags = "2.4.2" +num-traits = "0.2" +num-derive = "0.4" +log = "0.4.21" + +[target.'cfg(windows)'.dependencies] +etw-reader = { path = "../etw-reader" } + +# linux-perf-data = "0.10.1" +[[example]] +name = "dump-nettrace" \ No newline at end of file diff --git a/coreclr-tracing/examples/dump-nettrace.rs b/coreclr-tracing/examples/dump-nettrace.rs new file mode 100644 index 00000000..795b721d --- /dev/null +++ b/coreclr-tracing/examples/dump-nettrace.rs @@ -0,0 +1,110 @@ +#![allow(unused)] +use std::fs::File; + +use coreclr_tracing::*; +use coreclr_tracing::nettrace::*; + +// https://github.com/microsoft/perfview/blob/main/src/TraceEvent/EventPipe/EventPipeFormat.md + +fn main() { + // open file as binary, argv[1] + let mut file = File::open(std::env::args().nth(1).unwrap()).unwrap(); + + let mut reader = EventPipeParser::new(file).expect("Failed to make EventPipeParser"); + + loop { + match reader.next_event() { + Ok(Some(event)) => { + //if event.provider_name == "Microsoft-DotNETCore-SampleProfiler" { + // continue; + //} + + match coreclr_tracing::nettrace::decode_event(&event) { + DecodedEvent::CoreClrEvent((meta, coreclr_event)) => { + match coreclr_event { + CoreClrEvent::MethodLoad(event) => { + println!( + "MethodLoad: 0x{:16x} -- {}.{}", + event.method_start_address, + event.method_namespace, + event.method_name + ); + } + CoreClrEvent::GcTriggered(event) => { + println!("GcTriggered: {:?}", event.reason); + } + CoreClrEvent::GcAllocationTick(event) => { + //println!("GcAllocationTick: {:?}", event); + } + CoreClrEvent::ModuleLoad(event) => { + println!("ModuleLoad: {:?}", event); + } + CoreClrEvent::ModuleUnload(event) => { + println!("ModuleUnload: {:?}", event); + } + CoreClrEvent::MethodUnload(event) => { + println!("MethodUnload: {:?}", event); + } + CoreClrEvent::GcSampledObjectAllocation(event) => { + println!("GcSampledObjectAllocation: {:?}", event); + } + CoreClrEvent::ReadyToRunGetEntryPoint(event) => { + println!("ReadyToRunGetEntryPoint: {:?}", event); + } + CoreClrEvent::MethodDCEnd(event) => { + println!("MethodDCEnd: {:?}", event); + } + CoreClrEvent::GcStart(event) => { + println!("GcStart: {:?}", event); + } + CoreClrEvent::GcEnd(event) => { + println!("GcEnd: {:?}", event); + } + } + } + DecodedEvent::UnknownEvent => { + let mut handled = false; + + if event.provider_name == "Microsoft-Windows-DotNETRuntime" { + handled = true; + match event.event_id { + 145 => println!("MethodJittingStarted [Unhandled]"), + 146 => println!("MemoryAllocatedForJitCode [Unhandled]"), + _ => handled = false, + } + } else if event.provider_name == "Microsoft-Windows-DotNETRuntimeRundown" { + handled = true; + match event.event_id { + 10 => println!("Rundown: GCSettingsRundown [Unhandled]"), + 146 => println!("Rundown: DCEndComplete [Unhandled] @ {}", event.timestamp), + 148 => println!("Rundown: DCEndInit [Unhandled] @ {}", event.timestamp), + 150 => println!("Rundown: MethodDCEndILToNativeMap_V1 [Unhandled]"), + 152 => println!("Rundown: DomainModuleDCEnd [Unhandled]"), + 154 => println!("Rundown: ModuleDCEnd [Unhandled] @ {}", event.timestamp), + 156 => println!("Rundown: AssemblyDCEnd [Unhandled]"), + 158 => println!("Rundown: AppDomainDCEnd [Unhandled]"), + 187 => println!("Rundown: RuntimeInformationDCStart [Unhandled]"), + _ => handled = false, + } + } + + if !handled { + println!("Unknown: {} / {}", event.provider_name, event.event_id); + } + } + } + + //println!("{} -- ({} {}){:?}", name, event); + //println!("{} -- ({} {})", name, event.provider_name, event.event_id); + } + Ok(None) => { + println!("EOF"); + break; + } + Err(e) => { + println!("Error: {:?}", e); + break; + } + } + } +} diff --git a/coreclr-tracing/src/coreclr/enums.rs b/coreclr-tracing/src/coreclr/enums.rs new file mode 100644 index 00000000..7099fbc6 --- /dev/null +++ b/coreclr-tracing/src/coreclr/enums.rs @@ -0,0 +1,141 @@ +use bitflags::bitflags; + +use std::fmt::Display; + +use binrw::BinRead; +use num_derive::FromPrimitive; + +#[derive(BinRead, Debug, FromPrimitive, Clone, Copy)] +#[br(repr = u32)] +pub enum GcReason { + AllocSmall = 0, + Induced = 1, + LowMemory = 2, + Empty = 3, + AllocLargeObjectHeap = 4, + OutOfSpaceSmallObjectHeap = 5, + OutOfSpaceLargeObjectHeap = 6, + InducedNotForced = 7, + Stress = 8, + InducedLowMemory = 9, +} + +impl Display for GcReason { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + GcReason::AllocSmall => f.write_str("Small object heap allocation"), + GcReason::Induced => f.write_str("Induced"), + GcReason::LowMemory => f.write_str("Low memory"), + GcReason::Empty => f.write_str("Empty"), + GcReason::AllocLargeObjectHeap => f.write_str("Large object heap allocation"), + GcReason::OutOfSpaceSmallObjectHeap => { + f.write_str("Out of space (for small object heap)") + } + GcReason::OutOfSpaceLargeObjectHeap => { + f.write_str("Out of space (for large object heap)") + } + GcReason::InducedNotForced => f.write_str("Induced but not forced as blocking"), + GcReason::Stress => f.write_str("Stress"), + GcReason::InducedLowMemory => f.write_str("Induced low memory"), + } + } +} + +#[derive(BinRead, Debug, FromPrimitive, Clone, Copy)] +#[br(repr = u32)] +pub enum GcAllocationKind { + Small = 0, + Large = 1, + Pinned = 2, +} + +impl Display for GcAllocationKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + GcAllocationKind::Small => f.write_str("Small"), + GcAllocationKind::Large => f.write_str("Large"), + GcAllocationKind::Pinned => f.write_str("Pinned"), + } + } +} + +#[derive(BinRead, Debug, FromPrimitive, Clone, Copy)] +#[br(repr = u32)] +pub enum GcType { + Blocking = 0, + Background = 1, + BlockingDuringBackground = 2, +} + +impl Display for GcType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + GcType::Blocking => f.write_str("Blocking GC"), + GcType::Background => f.write_str("Background GC"), + GcType::BlockingDuringBackground => f.write_str("Blocking GC during background GC"), + } + } +} + +#[derive(BinRead, Debug, FromPrimitive, Clone, Copy)] +#[br(repr = u32)] +pub enum GcSuspendEeReason { + Other = 0, + GC = 1, + AppDomainShutdown = 2, + CodePitching = 3, + Shutdown = 4, + Debugger = 5, + GcPrep = 6, + DebuggerSweep = 7, +} + +impl Display for GcSuspendEeReason { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + GcSuspendEeReason::Other => f.write_str("Other"), + GcSuspendEeReason::GC => f.write_str("GC"), + GcSuspendEeReason::AppDomainShutdown => f.write_str("AppDomain shutdown"), + GcSuspendEeReason::CodePitching => f.write_str("Code pitching"), + GcSuspendEeReason::Shutdown => f.write_str("Shutdown"), + GcSuspendEeReason::Debugger => f.write_str("Debugger"), + GcSuspendEeReason::GcPrep => f.write_str("GC prep"), + GcSuspendEeReason::DebuggerSweep => f.write_str("Debugger sweep"), + } + } +} + +bitflags! { + #[derive(PartialEq, Eq)] + pub struct CoreClrMethodFlags: u32 { + const dynamic = 0x1; + const generic = 0x2; + const has_shared_generic_code = 0x4; + const jitted = 0x8; + const jit_helper = 0x10; + const profiler_rejected_precompiled_code = 0x20; + const ready_to_run_rejected_precompiled_code = 0x40; + + // next three bits are the tiered compilation level + const opttier_bit0 = 0x80; + const opttier_bit1 = 0x100; + const opttier_bit2 = 0x200; + + // extent flags/value (hot/cold) + const extent_bit_0 = 0x10000000; // 0x1 == cold, 0x0 = hot + const extent_bit_1 = 0x20000000; // always 0 for now looks like + const extent_bit_2 = 0x40000000; + const extent_bit_3 = 0x80000000; + + const _ = !0; + } + + #[derive(PartialEq, Eq)] + pub struct TieredCompilationSettings: u32 { + const none = 0x0; + const quick_jit = 0x1; + const quick_jit_for_loops = 0x2; + const tiered_pgo = 0x4; + const ready_to_run = 0x8; + } +} diff --git a/coreclr-tracing/src/coreclr/etw.rs b/coreclr-tracing/src/coreclr/etw.rs new file mode 100644 index 00000000..20f0f4a0 --- /dev/null +++ b/coreclr-tracing/src/coreclr/etw.rs @@ -0,0 +1,358 @@ +use std::{collections::HashMap, convert::TryInto}; + +use crate::EventMetadata; +use super::*; +use num_traits::FromPrimitive; + +use etw_reader::{self, schema::TypedEvent}; +use etw_reader::parser::{Parser, TryParse}; + +pub struct CoreClrEtwConverter { + last_event_on_thread: HashMap, + //last_event: String, +} + +impl CoreClrEtwConverter { + pub fn new() -> Self { + Self { + last_event_on_thread: HashMap::new(), + //last_event: String::default(), + } + } + + pub fn remaining_clr_events_on_threads( + &mut self, + ) -> std::collections::hash_map::IntoIter { + std::mem::take(&mut self.last_event_on_thread).into_iter() + } + + pub fn etw_event_to_coreclr_event( + &mut self, + s: &TypedEvent, + parser: &mut Parser, + ) -> Option<(EventMetadata, CoreClrEvent)> { + let timestamp_raw = s.timestamp() as u64; + + let mut name_parts = s.name().splitn(3, '/'); + let provider = name_parts.next().unwrap(); + let mut task = name_parts.next().unwrap(); + let mut opcode = name_parts.next().unwrap(); + + let is_rundown = match provider { + "Microsoft-Windows-DotNETRuntime" => false, + "Microsoft-Windows-DotNETRuntimeRundown" => true, + _ => { + panic!("Unexpected event {}", s.name()) + } + }; + + //let xx = format!("{} {} {}", provider, task, opcode); + //if xx != self.last_event { eprintln!("{} @ {}", xx, s.thread_id()); self.last_event = xx; } + + // When working with merged ETL files, the proper task and opcode names appear here, e.g. "CLRMethod/MethodLoadVerbose" or + // "CLRMethodRundown/MethodDCStartVerbose". When working with the unmerged user ETL, these show up as e.g. "Method /DCStartVerbose". + // Not clear where those names come from the Etw .man file in CoreCLR does have entries for e.g. RuntimePublisher.MethodDCStartVerboseOpcodeMessage + // as "DCStartVerbose", but I'm not sure how/why those are referenced here and not in the merged ETL. xperf -a dumper on the unmerged + // ETL shows the same (correct) names as the merged ETL. + // + // We try to hack around this by converting the unmerged name to the converted one here. + task = task.trim(); + opcode = opcode.trim(); + + // Some of these are technically not correct; e.g. the task should be CLRMethodRundown if it's the + // rundown provider, but we handle them the same below. + match task { + "Method" => { + task = "CLRMethod"; + opcode = match opcode { + "LoadVerbose" => "MethodLoadVerbose", + "UnloadVerbose" => "MethodUnloadVerbose", + "DCStartVerbose" => "MethodDCStartVerbose", + "DCEndVerbose" => "MethodDCEndVerbose", + "JittingStarted" => "MethodJittingStarted", + _ => opcode, + }; + }, + "Loader" => { + task = "CLRLoader"; + opcode = match opcode { + "ModuleDCStart" => "ModuleDCStart", + _ => opcode, + }; + }, + "Runtime" => { + task = "CLRRuntimeInformation"; + opcode = opcode.trim(); + }, + "GC" => { + task = "GarbageCollection"; + opcode = match opcode { + "PerHeapHisory" => opcode, + "GCDynamicEvent" => opcode, + "Start" => "win:Start", + "Stop" => "win:Stop", + "RestartEEStart" => "GCRestartEEBegin", + "RestartEEStop" => "GCRestartEEEnd", + "SuspendEEStart" => "GCSuspendEEBegin", + "SuspendEEStop" => "GCSuspendEEEnd", + _ => opcode, + }; + }, + "ClrStack" => { + task = "CLRStack"; + opcode = match opcode { + "Walk" => "CLRStackWalk", + _ => opcode, + }; + }, + _ => {}, + } + + let pid = s.process_id(); + let tid = s.thread_id(); + + // ETW CoreCLR stackwalk events are a separate event that comes after the event to which + // it should be attached. Our cross-platform CoreCLR events have the stack as an optional + // part of every event. So, if we're recording stacks from ETW, instead of returning + // non-stackwalk events directly, we store them as the last event for a given thread so + // that we can attach a stack. + // + // If we have a pending event and we get a stackwalk event, we'll attach the stack and + // return the pending event. + // If we get a non-stackwalk event, we'll store it, and still return this previous + // pending event. + let pending_event = self.last_event_on_thread.remove(&tid); + + // Handle StackWalk events outside of the big match below for cleanliness + if (task, opcode) == ("CLRStack", "CLRStackWalk") { + // If the STACK keyword is enabled, we get a CLRStackWalk following each CLR event that supports stacks. Not every event + // does. The info about which does and doesn't is here: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/ClrEtwAllMeta.lst + // Current dotnet (8.0.x) seems to have a bug where `MethodJitMemoryAllocatedForCode` events will fire a stackwalk, + // but the event itself doesn't end up in the trace. (https://github.com/dotnet/runtime/issues/102004) + + // if we don't have anything to attach this stack to, just skip it + if pending_event.is_none() { + //eprintln!("no pending event for stackwalk {}", tid); + return None; + } + + let pending_event = pending_event.unwrap(); + + // "Stack" is explicitly declared as length 2 in the manifest, so the first two addresses are in here, rest + // are in user data buffer. + let first_addresses: Vec = parser.parse("Stack"); + let address_iter = first_addresses + .chunks_exact(8) + .chain(parser.buffer.chunks_exact(8)) + .map(|chunk| u64::from_le_bytes(chunk.try_into().unwrap())); + + return Some((pending_event.0.with_stack(address_iter.collect()), pending_event.1)); + } + + let common = EventMetadata { + timestamp: timestamp_raw, + process_id: pid, + thread_id: tid, + stack: None, + is_rundown, + }; + + let new_event = match (task, opcode) { + ("CLRMethod" | "CLRMethodRundown", method_event) => match method_event { + "MethodLoadVerbose" | "MethodDCStartVerbose" | "MethodDCEndVerbose" => { + let method_name: String = parser.parse("MethodName"); + let method_namespace: String = parser.parse("MethodNamespace"); + let method_signature: String = parser.parse("MethodSignature"); + let module_id: u64 = parser.parse("ModuleID"); + let method_id: u64 = parser.parse("MethodID"); + let method_flags: u32 = parser.parse("MethodFlags"); + let method_token: u32 = parser.parse("MethodToken"); + let clr_instance_id: Option = parser.try_parse("ClrInstanceID").ok(); + let re_jit_id: Option = parser.try_parse("ReJITID").ok(); + + let method_start_address: u64 = parser.parse("MethodStartAddress"); + let method_size: u32 = parser.parse("MethodSize"); + + //log::trace!("{}: @ {:x} {}::{} {}", opcode, method_start_address, method_namespace, method_basename, method_signature); + + Some(CoreClrEvent::MethodLoad(MethodLoadUnloadEvent { + module_id, + method_start_address, + method_size, + method_name, + method_namespace, + method_signature, + method_id, + method_token, + method_flags, + clr_instance_id, + re_jit_id, + })) + } + _ => None, + }, + ("CLRLoader" | "CLRLoaderRundown", loader_event) => match loader_event { + // AppDomain, Assembly, Module Load/Unload + "ModuleDCStart" | _ => None, + }, + ("GarbageCollection", gc_event) => { + match gc_event { + "GCSampledObjectAllocation" => { + // If High/Low flags are set, then we get one of these for every alloc. Otherwise only + // when a threshold is hit. (100kb) The count and size are aggregates in that case. + + // There's a bug here in some windows processes, where TypeID is sent as a 32-bit value + // even in a 64-bit process. This commonly occurs with powershell.exe. Just ignore + // these events for now. + if let Some(type_id) = parser.try_parse("TypeID").ok() { + let address: u64 = parser.parse("Address"); + let object_count_for_type_sample: u32 = parser.parse("ObjectCountForTypeSample"); + let total_size_for_type_sample: u64 = parser.parse("TotalSizeForTypeSample"); + let clr_instance_id: u16 = parser.parse("ClrInstanceID"); + + Some(CoreClrEvent::GcSampledObjectAllocation( + GcSampledObjectAllocationEvent { + address, + type_id, + object_count_for_type_sample, + total_size_for_type_sample, + clr_instance_id, + }, + )) + } else { + None + } + } + "Triggered" => { + let reason: u32 = parser.parse("Reason"); + let reason = GcReason::from_u32(reason).unwrap_or_else(|| { + log::warn!("Unknown CLR GC Triggered reason: {}", reason); + GcReason::Empty + }); + + Some(CoreClrEvent::GcTriggered(GcTriggeredEvent { + reason, + clr_instance_id: 0, + })) + } + "GCSuspendEEBegin" => { + // Reason, Count + //let _count: u32 = parser.parse("Count"); + let reason: u32 = parser.parse("Reason"); + + let _reason = GcSuspendEeReason::from_u32(reason).unwrap_or_else(|| { + log::warn!("Unknown CLR GCSuspendEEBegin reason: {}", reason); + GcSuspendEeReason::Other + }); + + //Some(CoreClrEvent::GcSuspendEeBegin(GcSuspendEeBeginEvent { + // common, + // reason, + //})) + // TODO + None + } + "GCSuspendEEEnd" => { + // TODO + None + } + "GCRestartEEBegin" => { + // TODO + None + } + "GCRestartEEEnd" => { + // TODO + None + } + "win:Start" => { + let count: u32 = parser.parse("Count"); + let depth: Option = parser.try_parse("Depth").ok(); + let reason: u32 = parser.parse("Reason"); + let gc_type = parser.try_parse("Type").ok().and_then(GcType::from_u32); + let clr_instance_id: Option = parser.try_parse("ClrInstanceID").ok(); + let client_sequence_number: Option = parser.try_parse("ClientSequenceNumber").ok(); + + let reason = GcReason::from_u32(reason).unwrap_or_else(|| { + log::warn!("Unknown CLR GCStart reason: {}", reason); + GcReason::Empty + }); + + Some(CoreClrEvent::GcStart(GcStartEvent { + count, + depth, + reason, + gc_type, + clr_instance_id, + client_sequence_number, + })) + } + "win:Stop" => { + let count: u32 = parser.parse("Count"); + let depth: u32 = parser.parse("Depth"); + let reason = parser.try_parse("Reason").ok().and_then(GcReason::from_u32); + Some(CoreClrEvent::GcEnd(GcEndEvent { + count, + depth, + reason, + })) + } + "SetGCHandle" => { + // TODO + None + } + "DestroyGCHandle" => { + // TODO + None + } + "GCFinalizersBegin" | "GCFinalizersEnd" | "FinalizeObject" => { + // TODO: create an interval + None + } + "GCCreateSegment" | "GCFreeSegment" | "GCDynamicEvent" | "GCHeapStats" => { + // don't care + None + } + _ => { + // don't care + None + } + } + } + ("CLRRuntimeInformation", _) => None, + ("Type", "BulkType") => { + //