<commit_before>/*
Freestore_client is a sample implementation of a freestore client.
*/
package main

import (
	"fmt"
	"log"
	"time"

	"github.com/mateusbraga/freestore/pkg/client"

	"net/http"
	_ "net/http/pprof"
)

func main() {
	var finalValue interface{}
	var err error

	go func() {
		log.Println(http.ListenAndServe("localhost:6061", nil))
	}()

	for {
		startRead := time.Now()
		finalValue, err = client.Read()
		endRead := time.Now()
		if err != nil {
			log.Fatalln(err)
		}

		startWrite := time.Now()
		err = client.Write(finalValue)
		endWrite := time.Now()
		if err != nil {
			log.Fatalln(err)
		}

		fmt.Printf("Read %v (%v)-> Write (%v)\n", finalValue, endRead.Sub(startRead), endWrite.Sub(startWrite))
	}
}
<commit_msg>Add nTotal to client<commit_after>/*
Freestore_client is a sample implementation of a freestore client.
*/
package main

import (
	"flag"
	"fmt"
	"log"
	"math"
	"time"

	"github.com/mateusbraga/freestore/pkg/client"

	"net/http"
	_ "net/http/pprof"
)

var (
	nTotal = flag.Uint64("n", math.MaxUint64, "number of times to perform a read and write operation")
)

func main() {
	var finalValue interface{}
	var err error

	go func() {
		log.Println(http.ListenAndServe("localhost:6061", nil))
	}()

	for i := uint64(0); i < *nTotal; i++ {
		startRead := time.Now()
		finalValue, err = client.Read()
		endRead := time.Now()
		if err != nil {
			log.Fatalln(err)
		}

		startWrite := time.Now()
		err = client.Write(finalValue)
		endWrite := time.Now()
		if err != nil {
			log.Fatalln(err)
		}

		fmt.Printf("Read %v (%v)-> Write (%v)\n", finalValue, endRead.Sub(startRead), endWrite.Sub(startWrite))
	}
}

{'fraction_non_alphanumeric': 0.16412446613788895, 'fraction_numerical': 0.009151921903599756, 'mean_word_length': 3.632768361581921, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '642083', 'n_tokens_mistral': 689, 'n_tokens_neox': 637, 'n_words': 146}