int test_sketch(char* sketch_type, unsigned buckets, unsigned rows, 
                    char* random_generator, char* hash_function,
                    char* pcap_file){
    unsigned int pkt_counter=0;   // packet counter 
    clock_t t1, t2, t3;
    //temporary packet buffers 
    struct pcap_pkthdr header; // The header that pcap gives us 
    const u_char *packet; // The actual packet 
    // Create the sketch as the type passed as parameter
    Sketch<KeyType>* sketch = get_sketch<KeyType>(sketch_type, buckets, rows, 
        random_generator, hash_function);
    if (sketch == NULL) {
        return -1;
    }
    //----------------- 
    //open the pcap file 
    pcap_t *handle; 
    char errbuf[PCAP_ERRBUF_SIZE];
    handle = pcap_open_offline(pcap_file, errbuf);   //call pcap library function 

    if (handle == NULL) {
        fprintf(stderr,"Couldn't open pcap file %s: %s\n", pcap_file, errbuf);
        return -1;
    }

    //----------------- 
    //Process one packet at a time
    while (packet = pcap_next(handle,&header)) {
        t1 = clock();
        // header contains information about the packet (e.g. timestamp) 
        u_char *pkt_ptr = (u_char *)packet; //cast a pointer to the packet data 
        //parse the first (ethernet) header, grabbing the type field 
        int ether_type = ((int)(pkt_ptr[12]) << 8) | (int)pkt_ptr[13]; 
        int ether_offset = 0; 

        if (ether_type == ETHER_TYPE_IP or ether_type == ETHER_TYPE_IPv6) //most common 
            ether_offset = 14; 
        else {
            fprintf(stderr, "Unknown ethernet type, %04X, skipping...\n", ether_type); 
            continue;
        }
        // Only from IP header:
        pkt_ptr += ether_offset;  //skip past the Ethernet II header 
        int packet_length = header.len-ether_offset;

        // Compute MD5
        unsigned char * tmp_hash;
        tmp_hash = MD5(pkt_ptr, packet_length, NULL);
        // Strip to the size of the sketch:
        uint64_t low_hash = low_md5(tmp_hash);
        
        // Update sketch
        t2 = clock();

        sketch->update(low_hash,1);
        t3 = clock();

        printf("%s,%u,%u,%u,%s,%s,%f,%f,%f,%f\n",
                sketch_type,
                sizeof(KeyType),
                buckets,
                rows,
                random_generator,
                hash_function,
                ((float)t1)/CLOCKS_PER_SEC, 
                ((float)t2)/CLOCKS_PER_SEC, 
                ((float)t3)/CLOCKS_PER_SEC,
                ((float)t3-t1)/CLOCKS_PER_SEC);
        pkt_counter++; //increment number of packets seen 
        
        if (pkt_counter >= 1000)
            break;

    } //end internal loop for reading packets (all in one file) 

    pcap_close(handle);  //close the pcap file 
    return 0; //done
}