about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/profiling
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-18 05:28:44 +0000
committerbors <bors@rust-lang.org>2023-04-18 05:28:44 +0000
commit74864fa496997a6498e623f0d2019ccb7eb6dad0 (patch)
tree90fc9fcdd8e4fb35b88ffa626a5f97a0b2734a62 /compiler/rustc_data_structures/src/profiling
parent386025117a6b7cd9e7f7c96946793db2ec8aa24c (diff)
parent5606653f01b6b2fbcbaa1b2ff37e04d4e66486f8 (diff)
downloadrust-74864fa496997a6498e623f0d2019ccb7eb6dad0.tar.gz
rust-74864fa496997a6498e623f0d2019ccb7eb6dad0.zip
Auto merge of #110481 - matthiaskrgr:rollup-phkkgm9, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109981 (Set commit information environment variables when building tools)
 - #110348 (Add list of supported disambiguators and suffixes for intra-doc links in the rustdoc book)
 - #110409 (Don't use `serde_json` to serialize a simple JSON object)
 - #110442 (Avoid including dry run steps in the build metrics)
 - #110450 (rustdoc: Fix invalid handling of nested items with `--document-private-items`)
 - #110461 (Use `Item::expect_*` and `ImplItem::expect_*` more)
 - #110465 (Assure everyone that `has_type_flags` is fast)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_data_structures/src/profiling')
-rw-r--r--compiler/rustc_data_structures/src/profiling/tests.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/profiling/tests.rs b/compiler/rustc_data_structures/src/profiling/tests.rs
new file mode 100644
index 00000000000..2b09de085da
--- /dev/null
+++ b/compiler/rustc_data_structures/src/profiling/tests.rs
@@ -0,0 +1,19 @@
+use super::JsonTimePassesEntry;
+
+#[test]
+fn with_rss() {
+    let entry =
+        JsonTimePassesEntry { pass: "typeck", time: 56.1, start_rss: Some(10), end_rss: Some(20) };
+
+    assert_eq!(entry.to_string(), r#"{"pass":"typeck","time":56.1,"rss_start":10,"rss_end":20}"#)
+}
+
+#[test]
+fn no_rss() {
+    let entry = JsonTimePassesEntry { pass: "typeck", time: 56.1, start_rss: None, end_rss: None };
+
+    assert_eq!(
+        entry.to_string(),
+        r#"{"pass":"typeck","time":56.1,"rss_start":null,"rss_end":null}"#
+    )
+}