工具/软件:
您好、专家
客户使用以下代码片段测试 L3 的性能。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具/软件:
您好、专家
客户使用以下代码片段测试 L3 的性能。
尊敬的 Ken:
下面是我正在使用的代码片段-
volatile uint32_t start_time = 0, end_time = 0;
int32_t a[1000];
void test(void *args)
{
uint32_t temp;
for(int32_t i=0; i<1000; i++){
a[i] = 1;
}
CycleCounterP_reset();
start_time = CycleCounterP_getCount32();
for(int32_t j=0;j<1000;j++)
{
temp = CSL_REG_RD((uint32_t *)0x88000000);
CSL_REG_WR((uint32_t *)0x88000000, temp+a[j]);
}
end_time = CycleCounterP_getCount32();
CacheP_wbInvAll((uint32_t)CacheP_TYPE_ALL);
DebugP_log("Number of cycles! %d\r\n", end_time - start_time);
}
请注意、 CSL_REG32_RD、 CSL_REG32_WR 宏定义使用“volatile “关键字、可实现直接存储器访问并避免任何优化。 而不是 CSL_REG32_WR/RD 、使用 CSL_REG_WR/RD 宏命令。
为了避免在发行版构建中进行循环优化、 我修改了您共享的代码、将存储在数组中的数字相加、而不是将 1 添加到 temp 中。
您会发现、无论 MPU 将 L3 配置为“缓存+可共享“还是“非缓存“、上述代码的时间消耗始终为 9000 个周期。
通过将 MPU 区域配置为“缓存“、您将启用缓存。 客户可以注释掉写入操作并检查 MPU 配置为缓存或未缓存时的周期。 我建议客户在调试模式下执行实验、以避免任何循环优化。
是否有任何更新为什么时间相似?
这比预期的时间长。 我需要内部检查有关该问题的信息。
此致、
Samhitha