Re: [PATCH v2 4/4] kernel-shark-qt: Add an example showing how to draw shapes and Graphs.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 24 Aug 2018 17:21:16 +0300
"Yordan Karadzhov (VMware)" <y.karadz@xxxxxxxxx> wrote:

> +int main(int argc, char **argv)
> +{
> +	struct kshark_context *kshark_ctx(nullptr);
> +	struct kshark_entry **data(nullptr);
> +	static char *input_file;
> +	bool status, shapes(false);
> +	size_t r, n_rows;
> +	int c, nBins;
> +
> +	while ((c = getopt(argc, argv, "si")) != -1) {
> +		switch(c) {
> +		case 'i':
> +			input_file = optarg;
> +			break;
> +		case 's':
> +			shapes = true;
> +
> +		default:
> +			break;
> +		}
> +	}
> +
> +	/* Create a new kshark session. */
> +	if (!kshark_instance(&kshark_ctx))

Should make some warning message. I ran this from the build directory
like:

 ../bin/dplot ../../trace.dat

and it did nothing. But if I ran it from the trace-cmd.git repo as

kernel-shark-qt/bin/dplot trace.dat

Then it did something. We need to make it work when called from
anywhere with a path to any trace.dat file. And give some kind of
message if no parameter is passed in.

Hmm, we should also probably make a separate directory for example
programs. Perhaps have a "demo" directory for these?

-- Steve

> +		return 1;
> +
> +	/* Open a trace data file produced by trace-cmd. */
> +	if (input_file)
> +		status = kshark_open(kshark_ctx, input_file);
> +	else
> +		status = kshark_open(kshark_ctx, default_file);
> +
> +	if (!status) {
> +		kshark_free(kshark_ctx);
> +		return 1;
> +	}
> +



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux