Не работал параметор -t всегда использоваось 4 ядра.
This commit is contained in:
parent
d78601505a
commit
5ff2c1757e
1 changed files with 10 additions and 10 deletions
20
main.c
20
main.c
|
|
@ -98,10 +98,10 @@ int main(int argc, char *argv[]) {
|
|||
//struct tred_pizdec* meta[];
|
||||
//pthread_t thread[];
|
||||
int err = 0;
|
||||
struct tred_pizdec** meta = malloc(sizeof(struct tred_pizdec) * 4);
|
||||
pthread_t *thread = malloc(sizeof(pthread_t) * 4);
|
||||
int tred, iterations;
|
||||
parse_ti_flags(argc, argv, &tred, &iterations);
|
||||
struct tred_pizdec** meta = malloc(sizeof(struct tred_pizdec) * tred);
|
||||
pthread_t *thread = malloc(sizeof(pthread_t) * tred);
|
||||
printf("iterations: %i\n", iterations);
|
||||
for (;iterations != 0; iterations--){
|
||||
if (tred != -1){
|
||||
|
|
@ -109,18 +109,18 @@ int main(int argc, char *argv[]) {
|
|||
for (size_t p = 0; p < sizeof(test_patterns)/sizeof(test_patterns[0]); ++p){
|
||||
printf("\rЗапушен патерн 0x%08X", test_patterns[p]);
|
||||
fflush(stdout);
|
||||
for (bool i = 0;(i != 4); i++){
|
||||
for (bool i = 0;(i != tred); i++){
|
||||
meta[i] = malloc(sizeof(struct tred_pizdec));
|
||||
meta[i]->id = p;
|
||||
meta[i]->mem = mem;
|
||||
meta[i]->words_stop = words/4*(i+1);
|
||||
meta[i]->words_start = i * words/4;
|
||||
meta[i]->words_stop = words/tred*(i+1);
|
||||
meta[i]->words_start = i * words/tred;
|
||||
DEBUG_PRINT("words_stop: %zu\n",meta[i]->words_stop);
|
||||
DEBUG_PRINT("words_start:%zu\n",meta[i]->words_start);
|
||||
pthread_create(&thread[i], NULL, fill_pattern_multi_tred, (void*)meta[i]);
|
||||
//pthread_join(thread[i], NULL);
|
||||
}
|
||||
for (bool i = 0;(i != 4); i++)
|
||||
for (bool i = 0;(i != tred); i++)
|
||||
pthread_join(thread[i], NULL);
|
||||
//fill_pattern(mem, words, test_patterns[p]);
|
||||
//printf("Жду\n");
|
||||
|
|
@ -129,18 +129,18 @@ int main(int argc, char *argv[]) {
|
|||
fflush(stdout);
|
||||
//int err = check_pattern(mem, words, test_patterns[p]);
|
||||
|
||||
for (bool i = 0;(i != 4); i++){
|
||||
for (bool i = 0;(i != tred); i++){
|
||||
meta[i] = malloc(sizeof(struct tred_pizdec));
|
||||
meta[i]->id = p;
|
||||
meta[i]->mem = mem;
|
||||
meta[i]->words_stop = words/4*(i+1);
|
||||
meta[i]->words_start = i * words/4;
|
||||
meta[i]->words_stop = words/tred*(i+1);
|
||||
meta[i]->words_start = i * words/tred;
|
||||
DEBUG_PRINT("words_stop: %zu\n",meta[i]->words_stop);
|
||||
DEBUG_PRINT("words_start:%zu\n",meta[i]->words_start);
|
||||
pthread_create(&thread[i], NULL, fill_increment_multi_tred, (void*)meta[i]);
|
||||
//pthread_join(thread[i], NULL);
|
||||
}
|
||||
for (bool i = 0;(i != 4); i++){
|
||||
for (bool i = 0;(i != tred); i++){
|
||||
pthread_join(thread[i], NULL);
|
||||
err += meta[i]->return_error;
|
||||
free(meta[i]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue