()
| 39 | ) |
| 40 | |
| 41 | func main() { |
| 42 | mode := flag.String("mode", processEntry, "Mode for the tool to run in, either dcp or processEntry.") |
| 43 | nodes := flag.Int("sgwNodes", 1, "Number of sgw nodes to abstract. NOTE only relevant for processEntry mode.") |
| 44 | batchSize := flag.Int("batchSize", 10, "Batch size for the sequence allocator.") |
| 45 | timeToRun := flag.Duration("duration", 5*time.Minute, "Duration to run the test for in minutes. Examples: 3m for 3 minutes, 30s for 30 seconds etc") |
| 46 | delays := flag.String("writeDelay", "0", "Delay between writes in milliseconds. Must be entered in format <delayMS>,<delayMS>,<delayMS>.") |
| 47 | profileInterval := flag.Duration("profileInterval", 0*time.Second, "Interval for profiling to be triggered on, example 10s would be every 10 seconds.") |
| 48 | numChannelsPerDoc := flag.Int("numChannels", 1, "Number of channels to create per document.") |
| 49 | totalNumberOfChans := flag.Int("totalNumberOfChans", 1, "Total number of channels to create in the system.") |
| 50 | numOfChangesFeeds := flag.Int("numChangesFeeds", 0, "Number of changes feeds to create. Used only for DCP mode.") |
| 51 | channelsPerClient := flag.Int("channelsPerClient", 0, "Number of channels per client to wait on. Used only for DCP mode.") |
| 52 | rapidUpdateDocs := flag.Bool("rapidUpdateDocs", false, "Have documents rapidly updated (use of recent sequences). Used only for DCP mode.") |
| 53 | numDCPWorkers := flag.Int("numDCPWorkers", 8, "Number of DCP workers to create. Default is 8. Used only for DCP mode.") |
| 54 | numVBuckets := flag.Int("numVBuckets", 1024, "Number of vBuckets to create. Used only for DCP mode. Default is 1024.") |
| 55 | flag.Parse() |
| 56 | |
| 57 | if *nodes < 1 { |
| 58 | log.Fatalf("Invalid number of nodes: %d", *nodes) |
| 59 | } |
| 60 | if *numOfChangesFeeds < 0 { |
| 61 | log.Fatalf("Invalid number of changes feeds: %d", *numOfChangesFeeds) |
| 62 | } |
| 63 | if *batchSize < 1 || *batchSize > 10 { |
| 64 | log.Fatalf("Invalid batch size: %d", *batchSize) |
| 65 | } |
| 66 | if *timeToRun < 1 { |
| 67 | log.Fatalf("Invalid duration: %d", *timeToRun) |
| 68 | } |
| 69 | if *numChannelsPerDoc < 1 { |
| 70 | log.Fatalf("Invalid number of channels: %d", *numChannelsPerDoc) |
| 71 | } |
| 72 | if profileInterval.Seconds() != 0 && *profileInterval >= *timeToRun { |
| 73 | log.Fatalf("Invalid profile interval: %d, must be less than the duration of test: %d", *profileInterval, *timeToRun) |
| 74 | } |
| 75 | if *totalNumberOfChans < 1 && *totalNumberOfChans <= *numChannelsPerDoc { |
| 76 | log.Fatalf("Invalid total number of channels: %d", *totalNumberOfChans) |
| 77 | } |
| 78 | if *channelsPerClient < 0 { |
| 79 | log.Fatalf("Invalid number of channels per client: %d", *channelsPerClient) |
| 80 | } |
| 81 | if *numDCPWorkers < 1 { |
| 82 | log.Fatalf("Invalid number of DCP workers: %d", *numDCPWorkers) |
| 83 | } |
| 84 | |
| 85 | delayList, err := extractDelays(*delays, *mode) |
| 86 | if err != nil { |
| 87 | return |
| 88 | } |
| 89 | // need to have a delay for each node defined so we have variable write throughput |
| 90 | if len(delayList) != *nodes && *mode == processEntry { |
| 91 | log.Printf("invalid number of delays, number of input delays should match number of nodes: "+ |
| 92 | "Delays=%d and number of nodes=%d", len(delayList), *nodes) |
| 93 | return |
| 94 | } |
| 95 | |
| 96 | parentCtx := context.Background() |
| 97 | ctx, cancelFunc := context.WithCancel(parentCtx) |
| 98 |
nothing calls this directly
no test coverage detected