How to measure time inside Kenrel

There is any method to measure a part of code inside kernel?

There is any method to measure a part of code inside kernel?

clock()

clock()

The only thing to do is

void mykenrel(...)

{

...

  ...

  start = clock();

  for()

  ...

  ...

  end = clock();

  time = end - start;

}

The clock is time or cycle of gpu? If it is cycles how can I take time?

The only thing to do is

void mykenrel(...)

{

...

  ...

  start = clock();

  for()

  ...

  ...

  end = clock();

  time = end - start;

}

The clock is time or cycle of gpu? If it is cycles how can I take time?

If core clock cycles (half of the shader clock).

If core clock cycles (half of the shader clock).

The deviceQuery print Clock rate = 1.9Ghz. I must divide with this rate? Also this rate is from a processor of my 128 or the rate for all processor together?

The deviceQuery print Clock rate = 1.9Ghz. I must divide with this rate? Also this rate is from a processor of my 128 or the rate for all processor together?

I understand that all thread in one block do the same number of clocks but how can I take time from clocks?

I understand that all thread in one block do the same number of clocks but how can I take time from clocks?

Interested as well