Changeset 6117fc0
- Timestamp:
- Jan 20, 2022, 11:18:11 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- d3261710
- Parents:
- 753fb978
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/main.cfa
r753fb978 r6117fc0 6 6 #include <unistd.h> 7 7 extern "C" { 8 #include <sched.h> 8 9 #include <signal.h> 9 10 #include <sys/socket.h> … … 67 68 (this.self){ "Server Cluster", options.clopts.params }; 68 69 70 cpu_set_t fullset; 71 CPU_ZERO(&fullset); 72 int ret = sched_getaffinity(getpid(), sizeof(fullset), &fullset); 73 if( ret != 0 ) abort | "sched_getaffinity failed with" | errno | strerror( errno ); 74 int cnt = CPU_COUNT(&fullset); 75 69 76 this.procs = alloc(options.clopts.nprocs); 70 77 for(i; options.clopts.nprocs) { 71 78 (this.procs[i]){ "Benchmark Processor", this.self }; 79 80 int c = 0; 81 int n = 1 + (i % cnt); 82 for(int j = 0; j < CPU_SETSIZE; j++) { 83 if(CPU_ISSET(j, &fullset)) n--; 84 if(n == 0) { 85 c = j; 86 break; 87 } 88 } 89 cpu_set_t localset; 90 CPU_ZERO(&localset); 91 CPU_SET(c, &localset); 92 ret = pthread_setaffinity_np(this.procs[i].kernel_thread, sizeof(localset), &localset); 93 if( ret != 0 ) abort | "sched_getaffinity failed with" | ret | strerror( ret ); 72 94 73 95 #if !defined(__CFA_NO_STATISTICS__)
Note: See TracChangeset
for help on using the changeset viewer.