using xhprof in drupal 6 to monitor a cron task and display in the XHProf runs page
I haven't used the D6 version before but rummaging through the code I think something like this will work:

1st bit (taken from xhprof_shutdown_xhprof())

$namespace = variable_get('site_name', '');  // namespace for your application
$xhprof_data = xhprof_disable();

// Path to save file. Leave empty to use a default
$xhprof_data['path'] = isset($_GET['q'])?$_GET['q'] : ''; 
$class = variable_get('xhprof_default_class', 'XHProfRunsFile');
$xhprof_runs = new $class();
$run_id = $xhprof_runs-&gt;save_run($xhprof_data, $namespace);


2nd bit (taken from xhprof_display_page())

drupal_add_css(drupal_get_path('module', 'xhprof') . '/xhprof.css');
$html = xhprof_display_run(array($run_id), NULL);

// Do what you need to with $html to get it out to the screen