cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dineshjoshi <...@git.apache.org>
Subject [GitHub] cassandra pull request #244: Refactor and add samplers for CASSANDRA-14436
Date Sat, 04 Aug 2018 02:43:38 GMT
Github user dineshjoshi commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/244#discussion_r207697637
  
    --- Diff: src/java/org/apache/cassandra/tools/nodetool/ProfileLoad.java ---
    @@ -0,0 +1,178 @@
    +package org.apache.cassandra.tools.nodetool;
    +
    +import static com.google.common.base.Preconditions.checkArgument;
    +import static org.apache.commons.lang3.StringUtils.join;
    +
    +import java.util.ArrayList;
    +import java.util.Arrays;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +import java.util.stream.Collectors;
    +
    +import javax.management.openmbean.CompositeData;
    +import javax.management.openmbean.OpenDataException;
    +
    +import org.apache.cassandra.metrics.Sampler.SamplerType;
    +import org.apache.cassandra.tools.NodeProbe;
    +import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
    +import org.apache.cassandra.tools.nodetool.formatter.TableBuilder;
    +import org.apache.cassandra.utils.Pair;
    +
    +import com.google.common.collect.Lists;
    +
    +import io.airlift.airline.Arguments;
    +import io.airlift.airline.Command;
    +import io.airlift.airline.Option;
    +
    +@Command(name = "profileload", description = "Low footprint profiling of activity for
a period of time")
    +public class ProfileLoad extends NodeToolCmd
    +{
    +    @Arguments(usage = "<keyspace> <cfname> <duration>", description
= "The keyspace, column family name, and duration in milliseconds")
    +    private List<String> args = new ArrayList<>();
    +
    +    @Option(name = "-s", description = "Capacity of the sampler, higher for more accuracy
(Default: 256)")
    +    private int capacity = 256;
    +
    +    @Option(name = "-k", description = "Number of the top samples to list (Default: 10)")
    +    private int topCount = 10;
    +
    +    @Option(name = "-a", description = "Comma separated list of samplers to use (Default:
all)")
    +    private String samplers = join(SamplerType.values(), ',');
    +
    +    @Override
    +    public void execute(NodeProbe probe)
    +    {
    +        checkArgument(args.size() == 3 || args.size() == 1 || args.size() == 0, "Invalid
arguments, either [keyspace table duration] or [duration] or no args");
    +        checkArgument(topCount < capacity, "TopK count (-k) option must be smaller
then the summary capacity (-s)");
    +        String keyspace = null;
    +        String table = null;
    +        Integer duration = 10000;
    --- End diff --
    
    What is the unit for `duration`? It might be better to just use `java.time.Duration`?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message