Support multiple nodes in test_speed
This commit is contained in:
		
							parent
							
								
									b9568cb052
								
							
						
					
					
						commit
						864e4392d3
					
				
							
								
								
									
										38
									
								
								test_speed.c
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								test_speed.c
									
									
									
									
									
								
							| @ -1,30 +1,56 @@ | ||||
| #include <stdint.h> | ||||
| #include <stddef.h> | ||||
| #include <stdio.h> | ||||
| #include <unistd.h> | ||||
| #include <sys/types.h> | ||||
| #include <linux/limits.h> | ||||
| 
 | ||||
| #include "ovni.h" | ||||
| 
 | ||||
| #define N 100000 | ||||
| #ifndef gettid | ||||
| # include <sys/syscall.h> | ||||
| # define gettid() ((pid_t)syscall(SYS_gettid)) | ||||
| #endif | ||||
| 
 | ||||
| int main() | ||||
| static inline void | ||||
| init() | ||||
| { | ||||
| 	char hostname[HOST_NAME_MAX]; | ||||
| 	char *appid; | ||||
| 
 | ||||
| 	if(gethostname(hostname, HOST_NAME_MAX) != 0) | ||||
| 	{ | ||||
| 		perror("gethostname failed"); | ||||
| 		abort(); | ||||
| 	} | ||||
| 
 | ||||
| 	ovni_proc_init(0, hostname, getpid()); | ||||
| 	ovni_thread_init(gettid()); | ||||
| 	ovni_add_cpu(0, 0); | ||||
| } | ||||
| 
 | ||||
| int main(int argc, char *argv[]) | ||||
| { | ||||
| 	struct ovni_ev ev = {0}; | ||||
| 	int i; | ||||
| 	int i, n; | ||||
| 
 | ||||
| 	ovni_proc_init(0, "test", 0); | ||||
| 	ovni_thread_init(1); | ||||
| 	if(argv[1] != NULL) | ||||
| 		n = atoi(argv[1]); | ||||
| 	else | ||||
| 		n = 1000; | ||||
| 
 | ||||
| 	init(); | ||||
| 
 | ||||
| 	ovni_ev_set_mcv(&ev, "OB."); | ||||
| 
 | ||||
| 	for(i=0; i<N; i++) | ||||
| 	for(i=0; i<n; i++) | ||||
| 	{ | ||||
| 		ovni_clock_update(); | ||||
| 		ovni_ev(&ev); | ||||
| 	} | ||||
| 
 | ||||
| 	ovni_flush(); | ||||
| 	ovni_proc_fini(); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user