<commit_before>package main

import (
	"bufio"
	"flag"
	"fmt"
	"log"
	"os"
	"regexp"
	"sort"
	"strconv"
	"strings"
	"text/tabwriter"
)

type Line struct {
	Epoch   float64
	Db      int
	Command string
	Key     string
	Args    string
}

type Command struct {
	Name string
	Cnt  int
	Sum  float64
	Avg  float64
}

type Commands []Command

type Profile struct {
	Call string
	Args string
	Cnt  int
	Max  float64
	Min  float64
	Avg  float64
	Sum  float64
}

type Profiles []Profile

type ByCnt struct{ Profiles }
type ByMax struct{ Profiles }
type ByAvg struct{ Profiles }

type ByCommand struct{ Commands }
type ByHeavyCommand struct{ Commands }

func (p Profiles) Len() int      { return len(p) }
func (p Profiles) Swap(i, j int) { p[i], p[j] = p[j], p[i] }

func (c Commands) Len() int      { return len(c) }
func (c Commands) Swap(i, j int) { c[i], c[j] = c[j], c[i] }

func (p ByCnt) Less(i, j int) bool { return p.Profiles[i].Cnt < p.Profiles[j].Cnt }
func (p ByMax) Less(i, j int) bool { return p.Profiles[i].Max < p.Profiles[j].Max }
func (p ByAvg) Less(i, j int) bool { return p.Profiles[i].Avg < p.Profiles[j].Avg }

func (c ByCommand) Less(i, j int) bool      { return c.Commands[i].Cnt < c.Commands[j].Cnt }
func (c ByHeavyCommand) Less(i, j int) bool { return c.Commands[i].Sum < c.Commands[j].Sum }

const (
	SORT_TYPE_BY_MAX = "max"
	SORT_TYPE_BY_AVG = "avg"
	SORT_TYPE_BY_CNT = "cnt"
)

var (
	filePath = flag.String("f", "", "redis-cli monitor out put file")
	listNum  = flag.Int("n", 10, "Show Slowest Calls Count")
	sortType = flag.String("s", "max", "SlowestCalls type: max, avg, cnt")<commit_msg>Fix help message<commit_after>package main

import (
	"bufio"
	"flag"
	"fmt"
	"log"
	"os"
	"regexp"
	"sort"
	"strconv"
	"strings"
	"text/tabwriter"
)

type Line struct {
	Epoch   float64
	Db      int
	Command string
	Key     string
	Args    string
}

type Command struct {
	Name string
	Cnt  int
	Sum  float64
	Avg  float64
}

type Commands []Command

type Profile struct {
	Call string
	Args string
	Cnt  int
	Max  float64
	Min  float64
	Avg  float64
	Sum  float64
}

type Profiles []Profile

type ByCnt struct{ Profiles }
type ByMax struct{ Profiles }
type ByAvg struct{ Profiles }

type ByCommand struct{ Commands }
type ByHeavyCommand struct{ Commands }

func (p Profiles) Len() int      { return len(p) }
func (p Profiles) Swap(i, j int) { p[i], p[j] = p[j], p[i] }

func (c Commands) Len() int      { return len(c) }
func (c Commands) Swap(i, j int) { c[i], c[j] = c[j], c[i] }

func (p ByCnt) Less(i, j int) bool { return p.Profiles[i].Cnt < p.Profiles[j].Cnt }
func (p ByMax) Less(i, j int) bool { return p.Profiles[i].Max < p.Profiles[j].Max }
func (p ByAvg) Less(i, j int) bool { return p.Profiles[i].Avg < p.Profiles[j].Avg }

func (c ByCommand) Less(i, j int) bool      { return c.Commands[i].Cnt < c.Commands[j].Cnt }
func (c ByHeavyCommand) Less(i, j int) bool { return c.Commands[i].Sum < c.Commands[j].Sum }

const (
	SORT_TYPE_BY_MAX = "max"
	SORT_TYPE_BY_AVG = "avg"
	SORT_TYPE_BY_CNT = "cnt"
)

var (
	filePath = flag.String("f", "", "redis-cli monitor output file")
	listNum  = flag.Int("n", 10, "Show Slowest Calls Count")
	sortType = flag.String("s", "max", "Set SlowestCalls Type: max, avg, cnt")
{'fraction_non_alphanumeric': 0.14108910891089108, 'fraction_numerical': 0.009900990099009901, 'mean_word_length': 3.5988620199146517, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, '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': '4747112', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1340, 'n_words': 389}