Anyway to obtain the average SM occupancy

Is there anyway to obtain or calculate the average SM occupancy rate after one block finished its task?

I think NVIDIA Compute Visual Profiler gives lot of statistics that may point to this…!

Thanks very much. I just read the brief intruction about this profiler from nvidia website. But I am using Linux shell to program and I think its ‘highly configurable tables and graphical views’ will not work. And can I obtain the relavant data in my own program?