/*
 *  	$Id: ac_stats.c,v 1.1 2011/02/14 05:45:15 rec Exp $
 *
 * Implementation of the Aho-Corasick algorithm.
 *
 * This file is public domain.
 */

#include <stdio.h>
#include "ac.h"
/*
 * ac_stats
 *
 * Report statistics on a given AC_Struct
 *
 * Parameters:  file - a FILE * stream file
 *              node  -  a AC_Struct structure
 *
 * Returns:  nothing.
 */
void
ac_stats(FILE *f, AC_Handle node)
{
  fprintf(f,"Statistics report:\n");
  fprintf(f,"  from ac_prep():\n");
  fprintf(f,"    new edges:          %10lu\n", node->prep_new_edges);
  fprintf(f,"    old edges:          %10lu\n", node->prep_old_edges);
  fprintf(f,"    fail compares:      %10lu\n", node->prep_fail_compares);
  fprintf(f,"  from ac_search():\n");
  fprintf(f,"    Compares:           %10lu\n", node->num_compares);
  fprintf(f,"    Failures:           %10lu\n", node->num_failures);
  fprintf(f,"    Outlinks Traversed: %10lu\n", node->outlinks_traversed);
}
/*
 * ac_clear_stats
 *
 * Zero out statistics on a given AC_Struct
 *
 * Parameters:  node  -  a AC_Struct structure
 *
 * Returns:  nothing.
 */
void
ac_clear_stats(AC_Handle node)
{
  node->prep_new_edges = 
    node->prep_old_edges = 
    node->prep_fail_compares = 
    node->num_compares = 
    node->num_failures = 
    node->outlinks_traversed = 0;
}
