Esempio n. 1
0
int main(int argc, char *argv[])
{
	int c, ret;
	char *tracefile;
	char *lxtfile, *savefile;

	while ((c = getopt(argc, argv, "hvdcse:")) != -1) {
		switch (c) {

		case 'e':
			atag_init(optarg);
			break;

		case 'v':
			verbose = 1;
			break;

		case 'd':
			diag = 1;
			break;

		case 'c':
			gtkwave_parrot = 1;
			break;

		case 's':
			show_cpu_switch = !show_cpu_switch;

		case 'h':
		default:
			usage();
			break;
		}
	}

	if ((optind != argc-1) && (optind != argc-3))
		usage();

	tracefile = argv[optind];

	if (optind == argc-3) {
		lxtfile = argv[optind+1];
		savefile = argv[optind+2];
	} else {
		/* make new names with proper extensions */
		if (tracefile[strlen(tracefile)-1] == '/')  /* strip last / */
			tracefile[strlen(tracefile)-1] = 0;
		ret = asprintf(&lxtfile, "%s.lxt", tracefile);
		assert(ret > 0);
		ret = asprintf(&savefile, "%s.sav", tracefile);
		assert(ret > 0);
	}

	save_dump_init(lxtfile);

	/* do the actual work */
	scan_lttng_trace(tracefile);

	/* create a savefile for GTKwave with comments, trace ordering, etc. */
	write_savefile(savefile);

	link_gtkw_file(tracefile, savefile);

	save_dump_close();

	if (optind != argc-3) {
		free(lxtfile);
		free(savefile);
	}

	unregister_modules();
	return 0;
}
Esempio n. 2
0
int main(int argc, char *argv[])
{
	int c, ret;
	char *tracefile;
	char *outputfile, *savefile;
	int rebase_clock = 1;

	while ((c = getopt(argc, argv, "hvdcse:S:a")) != -1) {
		switch (c) {

		case 'e':
			atag_init(optarg);
			break;

		case 'v':
			verbose = 1;
			break;

		case 'd':
			diag = 1;
			break;

		case 'c':
			gtkwave_parrot = 1;
			break;

		case 's':
			show_cpu_switch = !show_cpu_switch;
			break;

		case 'S':
			do_stats = atoi(optarg);
			break;
		case 'a':
			rebase_clock = 0;
			break;
		case 'h':
		default:
			usage();
			break;
		}
	}

	display_modules();

	if ((optind != argc-1) && (optind != argc-3))
		usage();

	tracefile = argv[optind];

	if (optind == argc-3) {
		outputfile = argv[optind+1];
		savefile = argv[optind+2];
	} else {
		/* make new names with proper extensions */
		if (tracefile[strlen(tracefile)-1] == '/')  /* strip last / */
			tracefile[strlen(tracefile)-1] = 0;
		ret = asprintf(&outputfile, "%s.fst", tracefile);
		assert(ret > 0);
		ret = asprintf(&savefile, "%s.sav", tracefile);
		assert(ret > 0);
	}

	save_dump_init(outputfile);

	/* do the actual work */
	scan_lttng_trace(tracefile, rebase_clock);

	/* create a savefile for GTKwave with comments, trace ordering, etc. */
	write_savefile(savefile);

	link_gtkw_file(tracefile, savefile);

	save_dump_close();

	fprintf(stdout, "%s: Generated '%s' file\n", argv[0], outputfile);

	if (optind != argc-3) {
		free(outputfile);
		free(savefile);
	}
	if (do_stats & STAT_IRQ)
		irq_stats();
	if (do_stats & STAT_SOFTIRQ)
		softirq_stats();

	unregister_modules();
	return 0;
}