You can do that already. Use the plotBar function - you can find examples of doing those statistics in the profile.c script library.