@@ -122,43 +122,29 @@ impl CategoryData {
122
122
}
123
123
124
124
fn json ( & self ) -> String {
125
+ macro_rules! j {
126
+ ( $category: tt, $rustic_name: ident) => {
127
+ format!( "{{ \" category\" : {}, \" time_ms\" : {} }}" , stringify!( $category) , self . times. $rustic_name / 1_000_000 )
128
+ }
129
+ }
130
+
125
131
format ! ( "[
126
- {{
127
- \" category\" : \" Parsing\" ,
128
- \" time_ms\" : {}
129
- }},
130
- {{
131
- \" category\" : \" Expansion\" ,
132
- \" time_ms\" : {}
133
- }},
134
- {{
135
- \" category\" : \" TypeChecking\" ,
136
- \" time_ms\" : {}
137
- }},
138
- {{
139
- \" category\" : \" BorrowChecking\" ,
140
- \" time_ms\" : {}
141
- }},
142
- {{
143
- \" category\" : \" Codegen\" ,
144
- \" time_ms\" : {}
145
- }},
146
- {{
147
- \" category\" : \" Linking\" ,
148
- \" time_ms\" : {}
149
- }},
150
- {{
151
- \" category\" : \" Other\" ,
152
- \" time_ms\" : {}
153
- }}
132
+ {},
133
+ {},
134
+ {},
135
+ {},
136
+ {},
137
+ {},
138
+ {}
154
139
]" ,
155
- self . times. parsing / 1_000_000 ,
156
- self . times. expansion / 1_000_000 ,
157
- self . times. type_checking / 1_000_000 ,
158
- self . times. borrow_checking / 1_000_000 ,
159
- self . times. codegen / 1_000_000 ,
160
- self . times. linking / 1_000_000 ,
161
- self . times. other / 1_000_000 )
140
+ j!( "Parsing" , parsing) ,
141
+ j!( "Expansion" , expansion) ,
142
+ j!( "TypeChecking" , type_checking) ,
143
+ j!( "BorrowChecking" , borrow_checking) ,
144
+ j!( "Codegen" , codegen) ,
145
+ j!( "Linking" , linking) ,
146
+ j!( "Other" , other)
147
+ )
162
148
}
163
149
}
164
150
0 commit comments