The experimental flag -a is used to ease the transition to the usage of ovni_thread_require(), as it may be posible to have traces in which not all libraries have requested their model. The flag causes all emulation models to be enabled. This flag is considered experimental and it may be removed or renamed in future versions.
		
			
				
	
	
		
			87 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			87 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
 | |
|  * SPDX-License-Identifier: GPL-3.0-or-later */
 | |
| 
 | |
| #include "emu_args.h"
 | |
| 
 | |
| #include "common.h"
 | |
| #include "ovni.h"
 | |
| #include "path.h"
 | |
| #include "models.h"
 | |
| #include <unistd.h>
 | |
| #include <string.h>
 | |
| #include <stdlib.h>
 | |
| 
 | |
| static char progname[] = "ovniemu";
 | |
| static char version[] = OVNI_LIB_VERSION;
 | |
| 
 | |
| static void
 | |
| usage(void)
 | |
| {
 | |
| 	rerr("%s -- version %s\n", progname, version);
 | |
| 	rerr("\n");
 | |
| 	rerr("Usage: %s [-c offsetfile] [-abdlh] tracedir\n", progname);
 | |
| 	rerr("\n");
 | |
| 	rerr("Options:\n");
 | |
| 	rerr("  -c offsetfile      Use the given offset file to correct\n");
 | |
| 	rerr("                     the clocks among nodes. It can be\n");
 | |
| 	rerr("                     generated by the ovnisync program\n");
 | |
| 	rerr("\n");
 | |
| 	rerr("  -a                 Enable all models (experimental)\n");
 | |
| 	rerr("\n");
 | |
| 	rerr("  -b                 Enable breakdown model (experimental)\n");
 | |
| 	rerr("\n");
 | |
| 	rerr("  -d                 Enable debug output (very verbose)\n");
 | |
| 	rerr("\n");
 | |
| 	rerr("  -l                 Enable linter mode. Extra tests will\n");
 | |
| 	rerr("                     be performed.\n");
 | |
| 	rerr("\n");
 | |
| 	rerr("  -h                 Show help.\n");
 | |
| 	rerr("\n");
 | |
| 	rerr("  tracedir           The output trace dir generated by ovni.\n");
 | |
| 	rerr("\n");
 | |
| 	rerr("The output PRV files are placed in the tracedir directory.\n");
 | |
| 	rerr("\n");
 | |
| 	rerr("Available emulation models:\n");
 | |
| 	models_print();
 | |
| 
 | |
| 	exit(EXIT_FAILURE);
 | |
| }
 | |
| 
 | |
| void
 | |
| emu_args_init(struct emu_args *args, int argc, char *argv[])
 | |
| {
 | |
| 	memset(args, 0, sizeof(struct emu_args));
 | |
| 
 | |
| 	int opt;
 | |
| 	while ((opt = getopt(argc, argv, "abdc:lh")) != -1) {
 | |
| 		switch (opt) {
 | |
| 			case 'c':
 | |
| 				args->clock_offset_file = optarg;
 | |
| 				break;
 | |
| 			case 'l':
 | |
| 				args->linter_mode = 1;
 | |
| 				break;
 | |
| 			case 'a':
 | |
| 				args->enable_all_models = 1;
 | |
| 				break;
 | |
| 			case 'b':
 | |
| 				args->breakdown = 1;
 | |
| 				break;
 | |
| 			case 'd':
 | |
| 				enable_debug();
 | |
| 				break;
 | |
| 			case 'h':
 | |
| 			default: /* '?' */
 | |
| 				usage();
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	if (optind >= argc) {
 | |
| 		err("missing tracedir");
 | |
| 		usage();
 | |
| 	}
 | |
| 
 | |
| 	args->tracedir = argv[optind];
 | |
| 	path_remove_trailing(args->tracedir);
 | |
| }
 |