Changeset a46f7b6
- Timestamp:
- Oct 11, 2022, 1:11:43 PM (19 months ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- a55472cc
- Parents:
- fd90096
- Files:
-
- 1 added
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/cluster.hfa
rfd90096 ra46f7b6 21 21 22 22 #include <limits.h> 23 #include <inttypes.h> 23 24 24 25 #include "clock.hfa" … … 30 31 31 32 // warn normally all ints 32 #define warn_large_before warnf( !strict || old_avg < 33_000_000_000, "Suspiciously large previous average: %'llu (%llx), %' ldms \n", old_avg, old_avg, program()`ms )33 #define warn_large_after warnf( !strict || ret < 33_000_000_000, "Suspiciously large new average after %' ldms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program()`ms, ret, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg )33 #define warn_large_before warnf( !strict || old_avg < 33_000_000_000, "Suspiciously large previous average: %'llu (%llx), %'" PRId64 "ms \n", old_avg, old_avg, program()`ms ) 34 #define warn_large_after warnf( !strict || ret < 33_000_000_000, "Suspiciously large new average after %'" PRId64 "ms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program()`ms, ret, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ) 34 35 35 36 // 8X linear factor is just 8 * x … … 41 42 static inline __readyQ_avg_t __to_readyQ_avg(unsigned long long intsc) { if(unlikely(0 == intsc)) return 0.0; else return log2(intsc); } 42 43 43 #define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %' ldms \n", old_avg, program()`ms )44 #define warn_large_after warnf( !strict || ret < 35.3, "Suspiciously large new average after %' ldms cputime: %'lf from %'llu-%'llu (%'llu, %'llu) and %'lf\n", program()`ms, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ); \44 #define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %'" PRId64 "ms \n", old_avg, program()`ms ) 45 #define warn_large_after warnf( !strict || ret < 35.3, "Suspiciously large new average after %'" PRId64 "ms cputime: %'lf from %'llu-%'llu (%'llu, %'llu) and %'lf\n", program()`ms, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ); \ 45 46 verify(ret >= 0) 46 47 -
tests/configs/.expect/parsenums.x86.txt
rfd90096 ra46f7b6 48 48 49 49 Usage: 50 parse bools [OPTIONS]...50 parsenums [OPTIONS]... 51 51 testing bool parameters 52 52 -i, --int test int … … 62 62 63 63 Usage: 64 parse bools [OPTIONS]...64 parsenums [OPTIONS]... 65 65 testing bool parameters 66 66 -i, --int test int … … 73 73 WIFEXITED : 1 WEXITSTATUS : 1 WIFSIGNALED : 0 WTERMSIG : 0 WCOREDUMP : 0 WIFSTOPPED : 0 WSTOPSIG : 1 WIFCONTINUED: 0 74 74 75 int :-3 76 unsigned :3 77 unsigned long :4294967296 78 unsigned long long :3 79 double :3.3 75 Argument '4294967296' for option l could not be parsed 76 77 Usage: 78 parsenums [OPTIONS]... 79 testing bool parameters 80 -i, --int test int 81 -u, --unsigned test unsigned 82 -l, --unsignedlong test unsigned long 83 -L, --unsignedlonglong test unsigned long long 84 -d, --double test double 85 -h, --help print this help message 80 86 Child status: 81 WIFEXITED : 1 WEXITSTATUS : 0 WIFSIGNALED : 0 WTERMSIG : 0 WCOREDUMP : 0 WIFSTOPPED : 0 WSTOPSIG : 0WIFCONTINUED: 087 WIFEXITED : 1 WEXITSTATUS : 1 WIFSIGNALED : 0 WTERMSIG : 0 WCOREDUMP : 0 WIFSTOPPED : 0 WSTOPSIG : 1 WIFCONTINUED: 0 82 88 83 89 Argument '18446744073709551616' for option L could not be parsed 84 90 85 91 Usage: 86 parse bools [OPTIONS]...92 parsenums [OPTIONS]... 87 93 testing bool parameters 88 94 -i, --int test int … … 99 105 100 106 Usage: 101 parse bools [OPTIONS]...107 parsenums [OPTIONS]... 102 108 testing bool parameters 103 109 -i, --int test int … … 113 119 114 120 Usage: 115 parse bools [OPTIONS]...121 parsenums [OPTIONS]... 116 122 testing bool parameters 117 123 -i, --int test int … … 127 133 128 134 Usage: 129 parse bools [OPTIONS]...135 parsenums [OPTIONS]... 130 136 testing bool parameters 131 137 -i, --int test int -
tests/configs/parsenums.cfa
rfd90096 ra46f7b6 14 14 #include <parseargs.hfa> 15 15 #include <fstream.hfa> 16 17 #if __SIZEOF_LONG__ == 4 18 #define BIG_UNSIGNED_LONG "4294967295" 19 #define TOO_BIG_UNSIGNED_LONG "4294967296" 20 #elif __SIZEOF_LONG__ == 8 21 #define BIG_UNSIGNED_LONG "18446744073709551615" 22 #define TOO_BIG_UNSIGNED_LONG "18446744073709551616" 23 #else 24 #error unexpected size of long 25 #endif 16 26 17 27 int true_main(const char * exec); … … 85 95 printf("no arg:\n"); 86 96 if(pid_t child = strict_fork(); child == 0) { 87 int ret = execle(path, "parse bools", (const char*)0p, env);97 int ret = execle(path, "parsenums", (const char*)0p, env); 88 98 if(ret < 0) { 89 99 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); … … 99 109 printf("all 0 arg:\n"); 100 110 if(pid_t child = strict_fork(); child == 0) { 101 int ret = execle(path, "parse bools", "-i=0", "-u=0", "-l=0", "-L=0", "-d=0", (const char*)0p, env);111 int ret = execle(path, "parsenums", "-i=0", "-u=0", "-l=0", "-L=0", "-d=0", (const char*)0p, env); 102 112 if(ret < 0) { 103 113 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); … … 113 123 printf("negative vals arg:\n"); 114 124 if(pid_t child = strict_fork(); child == 0) { 115 int ret = execle(path, "parse bools", "-i=-1", "-d=-1", (const char*)0p, env);125 int ret = execle(path, "parsenums", "-i=-1", "-d=-1", (const char*)0p, env); 116 126 if(ret < 0) { 117 127 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); … … 127 137 printf("funky notation arg:\n"); 128 138 if(pid_t child = strict_fork(); child == 0) { 129 int ret = execle(path, "parse bools", "-i=0x10", "-u=0x20", "-l=0x300", "-L=0x4000", "-d=5e6", (const char*)0p, env);139 int ret = execle(path, "parsenums", "-i=0x10", "-u=0x20", "-l=0x300", "-L=0x4000", "-d=5e6", (const char*)0p, env); 130 140 if(ret < 0) { 131 141 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); … … 141 151 printf("big values arg:\n"); 142 152 if(pid_t child = strict_fork(); child == 0) { 143 int ret = execle(path, "parse bools", "-i=2147483647", "-u=4294967295", "-l=4294967295", "-L=18446744073709551615", "-d=5e6", (const char*)0p, env);153 int ret = execle(path, "parsenums", "-i=2147483647", "-u=4294967295", "-l=" BIG_UNSIGNED_LONG, "-L=18446744073709551615", "-d=5e6", (const char*)0p, env); 144 154 if(ret < 0) { 145 155 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); … … 155 165 printf("too big values arg:\n"); 156 166 if(pid_t child = strict_fork(); child == 0) { 157 int ret = execle(path, "parse bools", "-i=2147483648", (const char*)0p, env);158 if(ret < 0) { 159 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 160 exit(1); 161 } 162 } 163 else { 164 int status = do_wait(child); 165 print_status(status); 166 } 167 printf("\n"); 168 169 if(pid_t child = strict_fork(); child == 0) { 170 int ret = execle(path, "parse bools", "-u=4294967296", (const char*)0p, env);171 if(ret < 0) { 172 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 173 exit(1); 174 } 175 } 176 else { 177 int status = do_wait(child); 178 print_status(status); 179 } 180 printf("\n"); 181 182 if(pid_t child = strict_fork(); child == 0) { 183 int ret = execle(path, "parse bools", "-l=4294967296", (const char*)0p, env);184 if(ret < 0) { 185 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 186 exit(1); 187 } 188 } 189 else { 190 int status = do_wait(child); 191 print_status(status); 192 } 193 printf("\n"); 194 195 if(pid_t child = strict_fork(); child == 0) { 196 int ret = execle(path, "parse bools", "-L=18446744073709551616", (const char*)0p, env);167 int ret = execle(path, "parsenums", "-i=2147483648", (const char*)0p, env); 168 if(ret < 0) { 169 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 170 exit(1); 171 } 172 } 173 else { 174 int status = do_wait(child); 175 print_status(status); 176 } 177 printf("\n"); 178 179 if(pid_t child = strict_fork(); child == 0) { 180 int ret = execle(path, "parsenums", "-u=4294967296", (const char*)0p, env); 181 if(ret < 0) { 182 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 183 exit(1); 184 } 185 } 186 else { 187 int status = do_wait(child); 188 print_status(status); 189 } 190 printf("\n"); 191 192 if(pid_t child = strict_fork(); child == 0) { 193 int ret = execle(path, "parsenums", "-l=" TOO_BIG_UNSIGNED_LONG, (const char*)0p, env); 194 if(ret < 0) { 195 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 196 exit(1); 197 } 198 } 199 else { 200 int status = do_wait(child); 201 print_status(status); 202 } 203 printf("\n"); 204 205 if(pid_t child = strict_fork(); child == 0) { 206 int ret = execle(path, "parsenums", "-L=18446744073709551616", (const char*)0p, env); 197 207 if(ret < 0) { 198 208 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); … … 208 218 printf("negative errors arg:\n"); 209 219 if(pid_t child = strict_fork(); child == 0) { 210 int ret = execle(path, "parse bools", "-u=-1", (const char*)0p, env);211 if(ret < 0) { 212 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 213 exit(1); 214 } 215 } 216 else { 217 int status = do_wait(child); 218 print_status(status); 219 } 220 printf("\n"); 221 222 if(pid_t child = strict_fork(); child == 0) { 223 int ret = execle(path, "parse bools", "-l=-1", (const char*)0p, env);224 if(ret < 0) { 225 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 226 exit(1); 227 } 228 } 229 else { 230 int status = do_wait(child); 231 print_status(status); 232 } 233 printf("\n"); 234 235 if(pid_t child = strict_fork(); child == 0) { 236 int ret = execle(path, "parse bools", "-L=-1", (const char*)0p, env);220 int ret = execle(path, "parsenums", "-u=-1", (const char*)0p, env); 221 if(ret < 0) { 222 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 223 exit(1); 224 } 225 } 226 else { 227 int status = do_wait(child); 228 print_status(status); 229 } 230 printf("\n"); 231 232 if(pid_t child = strict_fork(); child == 0) { 233 int ret = execle(path, "parsenums", "-l=-1", (const char*)0p, env); 234 if(ret < 0) { 235 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 236 exit(1); 237 } 238 } 239 else { 240 int status = do_wait(child); 241 print_status(status); 242 } 243 printf("\n"); 244 245 if(pid_t child = strict_fork(); child == 0) { 246 int ret = execle(path, "parsenums", "-L=-1", (const char*)0p, env); 237 247 if(ret < 0) { 238 248 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));
Note: See TracChangeset
for help on using the changeset viewer.