static void measure_sobel() { Int status; MessageQ_Msg msg; if (selfId == 0) { msg = MessageQ_alloc(HEAP_ID, MESSAGE_SIZE_IN_BYTES); if (msg == NULL) { System_abort("MessageQ_alloc failed\n"); } rawtimestamps0 = Timestamp_get32(); /* Kick off the loop */ rawtimestamps[0] = Timestamp_get32(); status = MessageQ_put(nextQueueId, msg); rawtimestamps2 = Timestamp_get32(); IMG_sobel_3x3_8((uint8_t *)0x90000000,(uint8_t *)0x91000000,1920,1080/8); rawtimestamps3 = Timestamp_get32(); status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER); rawtimestamps1 = Timestamp_get32(); System_printf("Whole complete cost %d\n",rawtimestamps1-rawtimestamps0); System_printf("core0 complete cost %d\n",rawtimestamps3-rawtimestamps2); } else if(1<=selfId<=6) { status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER); status = MessageQ_put(nextQueueId, msg); rawtimestamps4 = Timestamp_get32(); IMG_sobel_3x3_8((uint8_t *)(0x90000000+(1920*1080/8)*selfId),(uint8_t *)(0x91000000+(1920*1080/8)*selfId),1920,1080/8); rawtimestamps5 = Timestamp_get32(); System_printf("core%d complete cost %d\n",selfId,rawtimestamps5-rawtimestamps4); } else { status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER); rawtimestamps2 = Timestamp_get32(); IMG_sobel_3x3_8((uint8_t *)(0x90000000+(1920*1080/8)*selfId),(uint8_t *)(0x91000000+(1920*1080/8)*selfId),1920,1080/8); rawtimestamps3 = Timestamp_get32(); status = MessageQ_put(nextQueueId, msg); System_printf("core%d complete cost %d\n",selfId,rawtimestamps3-rawtimestamps2); } }
question:
measure_sobel() function exec in while loop;eight cores share the same project
1.Whole complete cost 94ms;but after the first exec,every other time in while loop just cost 2ms
2.every core do sobel processing one section ,so the process time with every core,it will be same or just a little different。but the time with every core print in the console is different some time。
3.i think that can i get time in every core,if can not do that,so the printed time is wrong.
another:
if i use other multi-core communication method like below code
every whole time cost in while loop is just the same。
but like above,if i add getting time in every core,the time with every core is not correct。
thanks
best regards。
void convert_func(){ Int status; int i; MessageQ_Msg msg[7]; if (selfId == 0) { for(i=0;i<7;i++){ msg[i]= MessageQ_alloc(HEAP_ID, MESSAGE_SIZE_IN_BYTES); if (msg== NULL) { System_abort("MessageQ_alloc failed\n"); } } timeStamp1 = Timestamp_get32();//getStartTime64(); status = MessageQ_put(nextQueueId1, msg[0]); if (status < 0) { System_abort("MessageQ_put failed\n"); } status = MessageQ_put(nextQueueId2, msg[1]); if (status < 0) { System_abort("MessageQ_put failed\n"); } status = MessageQ_put(nextQueueId3, msg[2]); if (status < 0) { System_abort("MessageQ_put failed\n"); } status = MessageQ_put(nextQueueId4, msg[3]); if (status < 0) { System_abort("MessageQ_put failed\n"); } status = MessageQ_put(nextQueueId5, msg[4]); if (status < 0) { System_abort("MessageQ_put failed\n"); } status = MessageQ_put(nextQueueId6, msg[5]); if (status < 0) { System_abort("MessageQ_put failed\n"); } status = MessageQ_put(nextQueueId7, msg[6]); if (status < 0) { System_abort("MessageQ_put failed\n"); } System_printf("core 0 MessageQ_put done\n"); System_printf("convert start\n"); timeStamp3 = Timestamp_get32();//getStartTime64(); IMG_sobel_3x3_8((uint8_t *)0x90000000,(uint8_t *)0x91000000,1920,1080/8); timeStamp4 = Timestamp_get32(); for(i=0;i<7;i++){ status = MessageQ_get(messageQ, &msg[i], MessageQ_FOREVER); if (status < 0) { System_abort("MessageQ_get failed\n"); } } timeStamp2 =Timestamp_get32(); System_printf("Whole covert time is %d\n",timeStamp2-timeStamp1); System_printf("core0 covert time is %d\n",timeStamp4-timeStamp3); } else{ status = MessageQ_get(messageQ, &msg[selfId-1], MessageQ_FOREVER); if (status < 0) { System_abort("MessageQ_get failed\n"); } timeStamp3 = Timestamp_get32(); IMG_sobel_3x3_8((uint8_t *)(0x90000000+(1920*1080/8)*selfId),(uint8_t *)(0x91000000+(1920*1080/8)*selfId),1920,1080/8); timeStamp4 = Timestamp_get32(); status = MessageQ_put(nextQueueId, msg[selfId-1]); if (status < 0) { System_abort("MessageQ_put failed\n"); } System_printf("core%d covert time is %d\n",selfId,timeStamp4-timeStamp3); } }