|
Hi, all
I am profiling my video encoder program on TI DM642 EVM. It's extremely slow. 17 hours has
passed but it even has not encoded one frame! Any way to speed it up?
Thank you
Yong
|
|
Hi Yong, One method (suggested by TI people) which I have started using for my video decoder is to use the timer register and do intrusive instrumentation of the major functions of the code. There is a slight overhead of using the timer, but overall it is would run in the same as without profiling. Also you will be able to run the code without any debug option (e.g. function profile debug), so it would be as optimized as the final version. Regards Piyush --- Yong Yang <> wrote: > Hi, all > > I am profiling my video encoder program on TI DM642 > EVM. It's extremely slow. 17 hours has passed but it > even has not encoded one frame! Any way to speed it > up? > > Thank you > Yong > --------------------------------- ===== ************************************** And---"A blind Understanding!" Heav'n replied. Piyush Kaul http://www.geocities.com/piyushkaul __________________________________ |
|
|
|
Hi, Piyush, Ganesh and all
I used clock() function to profile my encoder.
At the start of every function, i put
//yy
clock_t start=clock(); clock_t stop; static clock_t sum = 0; //to sum up total time the function costs static int enter_c = 0; //to count the times the function is called //yy end At the end of every function, i put
//yy added, record is a structure
//
record[0].n= ++enter_c; stop = clock(); sum += stop-start-overhead_c; record[0].t = sum; //yy struct record_type
{
clock_t t; //count time
int n; //count the times the function is called
}
At the end of main(), i write record to a file.
I find it run very slow, even if i only profile a few functions. And another question is
the total time is almost 0, although the function has been called a few hundred
times.
Can you tell me how you write the efficient code? Thank you
Yong
piyush kaul <p...@yahoo.com> wrote: Hi Yong, |
|
|
|
Hi Yong, The method is OK. Maybe you forgot to enable the clock by going to the menu Profiler->Enable Clock. As I suggested earlier, working with timer registers, using CSL macros might be a little more efficient. The flow would be the same as you use with clock(), but instead TIMER macros would be used to get timer count values. //I would modify your code to give an example main() { //Assuming that you configure the timer 2 in CDB //For each frame restart the counter, // to avoid wraparound problems TIMER_FSET(CTL2,HLD,1); TIMER_FSET(CTL2,GO,1); DecodeFrame() frameTime = TIMER_RGET(CNT2);//Total time for //eachframe } //Then for each function func1 { unsigned int start, stop; static unsigned int sum = 0; //the function costs static int enter_c = 0; //to count the times the start = TIMER_RGET(CNT2);//clock_t start=clock(); // function is called //yy end //At the end of every function, i put //yy added, record is a structure // record[0].n= ++enter_c; stop = TIMER_RGET(CNT2);//stop = clock(); sum += stop-start-overhead_c; record[0].t = sum; } Regards Piyush --- Yong Yang <> wrote: > Hi, Piyush, Ganesh and all > > I used clock() function to profile my encoder. > At the start of every function, i put > //yy > clock_t start=clock(); > clock_t stop; > static clock_t sum = 0; //to sum up total time the > function costs > static int enter_c = 0; //to count the times the > function is called > //yy end > > At the end of every function, i put > //yy added, record is a structure > // > record[0].n= ++enter_c; > stop = clock(); > sum += stop-start-overhead_c; > record[0].t = sum; > //yy > struct record_type > { > clock_t t; //count time > int n; //count the times the function is called > } > At the end of main(), i write record to a file. > > I find it run very slow, even if i only profile a > few functions. And another question is the total > time is almost 0, although the function has been > called a few hundred times. > > Can you tell me how you write the efficient code? > Thank you > > Yong > > piyush kaul <> wrote: > Hi Yong, > > One method (suggested by TI people) which I have > started using for my video decoder is to use the > timer > register and do intrusive instrumentation of the > major > functions of the code. There is a slight overhead of > using the timer, but overall it is would run in the > same as without profiling. Also you will be able to > run the code without any debug option (e.g. function > profile debug), so it would be as optimized as the > final version. > Regards > Piyush > > --- Yong Yang wrote: > > Hi, all > > > > I am profiling my video encoder program on TI > DM642 > > EVM. It's extremely slow. 17 hours has passed but > it > > even has not encoded one frame! Any way to speed > it > > up? > > > > Thank you > > Yong > > > > > > --------------------------------- > > > > ===== > ************************************** > And---"A blind Understanding!" Heav'n replied. > > Piyush Kaul > http://www.geocities.com/piyushkaul > > > __________________________________ > --------------------------------- > ===== ************************************** And---"A blind Understanding!" Heav'n replied. Piyush Kaul http://www.geocities.com/piyushkaul __________________________________ |
|
|
|
Hi, Piyush
Thanks for your answer
When i enable the clock by going to the menu Profiler->Enable Clock and run the program
again, the stdout window says invalid CIO command(17). There's no such problem when i
does not enable clock. Can you tell me what's wrong.
Thank you
Yongpiyush kaul <p...@yahoo.com> wrote:
Hi Yong, |
|
Hi Yong,
Sorry I couldn't reply to your earlier mail as I was busy
with some other stuff.
I would discourage you from employing clock because it would
be disadvantageous in case you wish that your application is repetitive.
In the sense, if you forget to Enable Clock from the
Profiler menu, it wouldn't generate any stuff.
Coming to your problem, it has been a known problem that cio
(Console I/O) module always has given problems to developers be it on any
platform.
I would suggest you to create a separate memory section
either in SDRAM or ISRAM but with a different name and space enough for only cio module. (You
can know the space reqd. from the map file generated with earlier memory configurations). Place
CIO in this section and I presume you shouldn't have any other problems regarding the
same.
On the other hand, a simple and straight solution would be
to use the TIMER module instead. Include csl (It will anyways be included already). Use the
Timer module. You need to define the TIMER_Handle, Unsigned long variables to hold the values.
You can find more information on using the same in the CSL documentation. Use TIMER_getCount
which can make your application run independently i.e. in terms of the IDE and
profiling.
Hope this helps.
Thanks and Regards, Ganesh
|
|
|
|
HI, Ganesh
Thanks for your answer. When i use TIMER_getCount() as you suggested, i always get 0. I have read through the help docoment about CSL, configured CDB file, used TIMER_start(). Anything else needed to be done to get it work? Thank you Yong
|
|
Hi, ganesh
I put cio module in the in SDRAM or ISRAM but with a different name
as you suggested, but the problem still exists. What do you think causes the
problem?
Thank you
Yong
|
|
Hi Yong,
Check your JTAG drivers. Usually this should
solve.
Ganesh
|