LaszloLadanyi

1

votes
0

answer
64

views

How to get CPU instruction count for a thread?

I know that getrusage() can provide per-thread CPU utilization, but only the time spent on the CPU. Is there any way to get the number of executed CPU instructions? Or the number of cycles spent on the cpu? Basically, I need to find a reproducible measure of how much the thread spends on the CPU. An...
LaszloLadanyi
1

votes
1

answer
67

views

How to manage hardware cache usage

I wonder if there is a way to directly manage which parts of the memory are loaded into (and kept in) the cache. I know that there is __builtin_prefetch() in gcc, but I would need a bit more (at least I think I would...). Here is my problem: I have a loop where I update a vector v (very pseudocode)...
LaszloLadanyi
1

votes
1

answer
84

views

what can cause huge variation in runtime of a multithreaded code

I'm not sure whether stackoverflow is the best forum, but here it goes... We are benchmarking our software. Suddenly we saw a huge performance degradation. To test what is happening we ran the software on the same input multiple times. The results were startling (huge performance variability): Solut...
LaszloLadanyi
2

votes
1

answer
39

views

how to optimize nested indexing in a loop

I have a very simple loop in C: for (i=0; i < len; ++i) { beta[index[i]] += d * value[i]; } In this loop beta and value are double arrays while index is an integer array. beta itself can be a very long array (potentially millions of elements), but len is typically much shorter, say, 5% of the length...
LaszloLadanyi
8

votes
2

answer
541

views

How to embed a C++ library in a C library?

I have a question related to embedding one library in another. I have a code that is pure C and my users rely on that, they don't want to depend on C++ libraries. However, the need arose to embed a 3rd party library (ICU) into mine. None of the ICU functions would be exported, they would only be use...
LaszloLadanyi