Beispiel #1
0
func main() {
	flag.Parse()
	logrus.SetLevel(logrus.DebugLevel)
	glog.WithField("numcpus", runtime.NumCPU()).Info("Number of cpus found.")

	procs := runtime.GOMAXPROCS(runtime.NumCPU())
	glog.WithField("prev_procs", procs).Info("Previous setting.")

	f, scanner := getScanner(*entities)
	defer f.Close()

	tr := trie.NewTrie()
	count := 0
	for scanner.Scan() {
		tr.Add(scanner.Text())
		count += 1
	}
	glog.WithField("count", count).Debug("Entities read.")
	grep(tr)

	/*
		var mstats runtime.MemStats
		runtime.ReadMemStats(&mstats)
		fmt.Printf("Memory Stats: %+v\n\n", mstats)
	*/
}
Beispiel #2
0
func main() {
	fmt.Println(strconv.FormatInt(32, 2))
	tree := trie.NewTrie()
	fmt.Println(tree.Dump())
	fmt.Println(tree.HasPrefix("123"))
	fmt.Println(tree.HasPrefix("23"))
	AddCIDR("1.2.3.4/24")

}