From: Robert Milkowski (rmilkowski@wp-sa.pl)
Date: Wed Nov 12 2003 - 06:08:38 EST
Hi.
I want to get %tick value into C program. I did:
bash-2.05$ cat rdtick.s
.global rdtick
.section ".text"
.align 4
rdtick:
retl
rd %tick,%o0
bash-2.05$ cat tick.c
int main()
{
int i=0;
while(i++<10)
printf("tick:%llu\n", rdtick());
};
Now when I compile it
gcc -Wa,-xarch=v9 -m64 -mcpu=v9 -o tick64 rdtick.s tick.c
bash-2.05$ ./tick64
tick:337968935442151
tick:337968935762949
tick:337968935784333
tick:337968935799495
tick:337968935813609
tick:337968935827893
tick:337968935842105
tick:337968935856369
tick:337968935870573
tick:337968935884873
Looks ok.
But When I compile it as 32bit binary:
gcc -Wa,-xarch=v8plus -m32 -mcpu=v9 -o tick32 rdtick.s tick.c
bash-2.05$ ./tick32
tick:4601813945903425596
tick:4602937414858778684
tick:4603017670617671740
tick:4603082876811159612
tick:4603147309910534204
tick:4603212945600751676
tick:4603277687937771580
tick:4603342997210474556
tick:4603407258511157308
tick:4603477558535858236
As you can see it looks like I get 32bit value of %tick (some garbage,
like in unsigned long lond first 32bit are ok, and another are garbage).
If executable is 32bit then registers are 64 or 32?
How can I get 64bit %tick in 32bit executable directly in asm without
calling gethrtime()? The problem is that 32bit value of tick is not enaugh
in profiling 'coz it's too small.
-- Robert Milkowski rmilkowski@wp-sa.pl _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagers
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:27:27 EDT