Re: Tracing memcpy for MIPS
Mathieu Desnoyers <[email protected]>
| Newsgroups | gmane.linux.kernel.tracing |
|---|---|
| Message-ID | <20070618132349.GB3063@Krystal> |
Hrm,
Thinking a little more about your problem, I come with a few other
things to consider:
ltt/ltt-serialize.c uses memcpy() for strings, arrays, and sequences.
You must make sure you do not use any %s, %v or %a in your marker format
string within memcpy, or you will end up with an infinite recursion.
Second thing:
you will find memcpy implementation in arch/mips/lib/memcpy.S and
memcpy-inatomic.S.
My suggestion, to keep it simple, is that you rename the original
memcpy into memcpy_notrace, then create a wrapper memcpy inline function
in asm-mips/string.h which would look like:
extern void *memcpy_notrace(void *__to, __const__ void *__from, size_t __n);
static inline void *memcpy(void *__to, __const__ void *__from, size_t __n)
{
__label__ memcpy_label;
trace_mark(lib_memcpy, "%lu", &&memcpy_label);
memcpy_label:
return memcpy_notrace(__to, __from, __n);
}
The second alternative is (it adds a function call):
In asm-mips/string.h:
extern void *memcpy_notrace(void *__to, __const__ void *__from, size_t __n);
extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
And create arch/mips/lib/memcpy.c:
void *memcpy(void *__to, __const__ void *__from, size_t __n)
{
trace_mark(lib_memcpy, "%lu", __builtin_return_address(0));
return memcpy_notrace(__to, __from, __n);
}
You should probably do the same for memcpy inatomic.
Mathieu
* Sagar Borikar ([email protected]) wrote:
>
> Hello,
>
> I am consistently using LTTng for tracing the MIPS system. While adding the events, I was bit stuck in finding out which of the kernel memcpy function is consuming lot of CPU. I need to search a kernel call which is having highest probability of stalling the cpu. So in short, I would like to see backtrace in LTTng. Can anyone point me out about using backtracking feature in LTTng if at all it is present?
>
> Thanks in advance,
>
> Sagar
>
> _______________________________________________
> Ltt-dev mailing list
> [email protected]
> http://listserv.shafik.org/mailman/listinfo/ltt-dev
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68