@@ -286,9 +286,9 @@ func slowestRulesCallback(
286
286
// SlowestRules returns information about the slowest rules and how much
287
287
// time they spent matching patterns and executing their conditions.
288
288
//
289
- // In order to use this function the YARA-X C library must be built with
290
- // support for rules profiling, which is done by enabling the `rules-profiling`
291
- // feature. Otherwise, calling this function will cause a panic.
289
+ // In order to use this function, the YARA-X C library must be built with
290
+ // support for rules profiling by enabling the `rules-profiling` feature.
291
+ // Otherwise, calling this function will cause a panic.
292
292
func (s * Scanner ) SlowestRules (n int ) []ProfilingInfo {
293
293
profilingInfo := make ([]ProfilingInfo , 0 )
294
294
slowestRules := cgo .NewHandle (& profilingInfo )
@@ -311,6 +311,19 @@ func (s *Scanner) SlowestRules(n int) []ProfilingInfo {
311
311
return profilingInfo
312
312
}
313
313
314
+ /// ClearProfilingData resets the profiling data collected during rule execution
315
+ /// across scanned files. Use it to start a new profiling session, ensuring the
316
+ /// results reflect only the data gathered after this method is called.
317
+ //
318
+ // In order to use this function, the YARA-X C library must be built with
319
+ // support for rules profiling by enabling the `rules-profiling` feature.
320
+ // Otherwise, calling this function will cause a panic.
321
+ func (s * Scanner ) ClearProfilingData () {
322
+ if C .yrx_scanner_clear_profiling_data (s .cScanner ) == C .NOT_SUPPORTED {
323
+ panic ("ClearProfilingData requires that the YARA-X C library is built with the `rules-profiling` feature" )
324
+ }
325
+ }
326
+
314
327
// Destroy destroys the scanner.
315
328
//
316
329
// Calling this method directly is not necessary, it will be invoked by the
0 commit comments