示例#1
0
文件: pk2dft.c 项目: GBert/misc
void print_family(FILE * f, family_ent_t * devfam_par) {
    fprintf(f, "name                = \"%s\"\n", devfam_par->name);
    fprintf(f, "fam_id              = %d\n", devfam_par->fam_id);
    fprintf(f, "fam_type            = %d\n", devfam_par->fam_type);
    fprintf(f, "search_prio         = %d\n", devfam_par->search_prio);
    fprintf(f, "prg_entry_script    = \"%s\"\n", script_name(devfam_par->prg_entry_script));
    fprintf(f, "prg_exit_script     = \"%s\"\n", script_name(devfam_par->prg_exit_script));
    fprintf(f, "rd_devid_script     = \"%s\"\n", script_name(devfam_par->rd_devid_script));
    fprintf(f, "devid_mask          = 0x%08x\n", devfam_par->devid_mask);
    fprintf(f, "blank_value         = 0x%08x\n", devfam_par->blank_value);
    fprintf(f, "bytes_per_loc       = %d\n", devfam_par->bytes_per_loc);
    fprintf(f, "addr_inc            = %d\n", devfam_par->addr_inc);
    fprintf(f, "b_detect            = %d\n", devfam_par->b_detect);
    fprintf(f, "prg_entry_vpp_script= \"%s\"\n", script_name(devfam_par->prg_entry_vpp_script));
    fprintf(f, "ee_bytes_per_word   = %d\n", devfam_par->ee_bytes_per_word);
    fprintf(f, "ee_addr_inc         = %d\n", devfam_par->ee_addr_inc);
    fprintf(f, "user_id_hex_bytes   = %d\n", devfam_par->user_id_hex_bytes);
    fprintf(f, "user_id_bytes       = %d\n", devfam_par->user_id_bytes);
    fprintf(f, "prog_mem_hex_bytes  = %d\n", devfam_par->prog_mem_hex_bytes);
    fprintf(f, "ee_mem_hex_bytes    = %d\n", devfam_par->ee_mem_hex_bytes);
    fprintf(f, "prg_mem_shift       = %d\n", devfam_par->prg_mem_shift);
    fprintf(f, "test_memory_start   = %d\n", devfam_par->test_memory_start);
    fprintf(f, "test_memory_length  = %d\n", devfam_par->test_memory_length);
    fprintf(f, "vpp                 = %f\n", devfam_par->vpp);
}
void StatisticsWriterXml::Write(const Statistics *stats)
{
	*stream() << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
	          << "<stats script=\"" << script_name() << "\"";
	
	if (print_date()) {
		*stream() << " timestamp=\"" << TimeStamp::Now() << "\"";
	}

	if (print_run_time()) {
		*stream() << " run_time=\"" << Seconds(stats->GetTotalRunTime()).count() << "\'";
	}

	*stream() << ">\n";

	std::vector<FunctionStatistics*> all_fn_stats;
	stats->GetStatistics(all_fn_stats);

	Nanoseconds time_all;
	for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
			iterator != all_fn_stats.end(); ++iterator)
	{
		const FunctionStatistics *fn_stats = *iterator;
		time_all += fn_stats->total_time() - fn_stats->child_time(); 
	}

	Nanoseconds total_time_all;
	for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
			iterator != all_fn_stats.end(); ++iterator)
	{
		const FunctionStatistics *fn_stats = *iterator;
		total_time_all += fn_stats->total_time(); 
	}

	for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
			iterator != all_fn_stats.end(); ++iterator)
	{
		const FunctionStatistics *fn_stats = *iterator;

		double self_time_sec = Seconds(fn_stats->GetSelfTime()).count();
		double self_time_percent = fn_stats->GetSelfTime().count() * 100 / time_all.count();

		double total_time_sec = Seconds(fn_stats->total_time()).count();
		double total_time_percent = fn_stats->total_time().count() * 100 / total_time_all.count();

		*stream() << "\t<function"
			<< " type=\"" << fn_stats->function()->type() << "\""
			<< " name=\"" << fn_stats->function()->name() << "\""
			<< " calls=\"" << fn_stats->num_calls() << "\""
			<< " self_time=\"" << fn_stats->GetSelfTime().count() << "\""
			<< " self_time_sec=\"" << self_time_sec << "\""
			<< " self_time_percent=\"" <<  std::fixed << std::setprecision(2) << self_time_percent << "\""
			<< " total_time=\"" << fn_stats->total_time().count() << "\""
			<< " total_time_sec=\"" << total_time_sec << "\""
			<< " total_time_percent=\"" <<  std::fixed << std::setprecision(2) << total_time_percent << "\""
		<< "/>\n";
	}

	*stream() << "</stats>";
}
示例#3
0
filter_result MenuFilter::Filter(BMessage *message, BHandler **target) 
{ 
	if (message->what != ABI_BEOS_MENU_EV) 
	{
		return(B_DISPATCH_MESSAGE);
	}
	//XAP_Menu_Id id = 0;
	BMenuItem* sourceItem;
	
	int32	id = 0;
	message->FindInt32(ABI_BEOS_MENU_EV_NAME, &id);
	message->FindPointer("source" , (void **)&sourceItem);
	//if(sourceItem->IsMarked())
	//	sourceItem->SetMarked(false);
	
	const EV_Menu_ActionSet * pMenuActionSet = m_pBeOSApp->getMenuActionSet();
	UT_ASSERT(pMenuActionSet);

	const EV_Menu_Action * pAction = pMenuActionSet->getAction(id);
	UT_ASSERT(pAction);

#if 0
	if(m_pBeOSFrame->getCurrentView() && pAction->hasGetStateFunction())
	{
		if(pAction->isCheckable() || pAction->isRadio())
		{
		
			EV_Menu_ItemState mis = pAction->getMenuItemState(m_pBeOSFrame->getCurrentView());
	    	if (mis & EV_MIS_Toggled)
        	    sourceItem->SetMarked(false);
        	else
        		sourceItem->SetMarked(true);
		}
	}
#endif
             
	const char * szMethodName = pAction->getMethodName();
	if (!szMethodName)
		return(B_SKIP_MESSAGE);
	
	const EV_EditMethodContainer * pEMC = m_pBeOSApp->getEditMethodContainer();
	UT_ASSERT(pEMC);

	EV_EditMethod * pEM = pEMC->findEditMethodByName(szMethodName);
	UT_ASSERT(pEM);						// make sure it's bound to something

	UT_String script_name(pAction->getScriptName());
	m_pEVMenu->invokeMenuMethod(m_pBeOSFrame->getCurrentView(), pEM, script_name);

	((EV_BeOSMenu *)m_pEVMenu)->synthesize();
	
	return(B_SKIP_MESSAGE);			
}
示例#4
0
static void show_breadcrump_field (const char *str, /* {{{ */
    const char *field_name)
{
  if ((str == NULL) || (str[0] == 0))
    printf ("<em>none</em>");
  else if (IS_ANY (str))
    printf ("<em>any</em>");
  else if (IS_ALL (str))
    printf ("<em>all</em>");
  else
  {
    char *str_html = html_escape (str);

    if (field_name != NULL)
      printf ("<a href=\"%s?action=search;q=%s:%s\">%s</a>",
          script_name (), field_name, str_html, str_html);
    else
      printf ("<a href=\"%s?action=search;q=%s\">%s</a>",
          script_name (), str_html, str_html);

    free (str_html);
  }
} /* }}} void show_breadcrump_field */
void StatisticsWriterHtml::Write(const Statistics *stats)
{
  *stream() <<
  "<!DOCTYPE html>\n"
  "<html>\n"
  "<head>\n"
  "  <title>" << "Profile of '" << script_name() << "'</title>\n"
  "  <script type=\"text/javascript\"\n"
  "          src=\"http://code.jquery.com/jquery-latest.min.js\">\n"
  "  </script>\n"
  "  <script type=\"text/javascript\"\n"
  "          src=\"http://tablesorter.com/__jquery.tablesorter.min.js\">\n"
  "  </script>\n"
  "  <script type=\"text/javascript\">\n"
  "    $(document).ready(function() {\n"
  "      $('#data').tablesorter();\n"
  "    });\n"
  "  </script>\n"
  "</head>\n"
  "<body>\n"
  ;

  *stream() <<
  "  <style type=\"text/css\">\n"
  "    table {\n"
  "      border-spacing: 0;\n"
  "      border-collapse: collapse;\n"
  "    }\n"
  "    table#data {\n"
  "      width: 100%;\n"
  "    }\n"
  "    table, th, td {\n"
  "      border-width: thin;\n"
  "      border-style: solid;\n"
  "      border-color: #aaaaaa;\n"
  "    }\n"
  "    th {\n"
  "      text-align: left;\n"
  "      background-color: #cccccc;\n"
  "    }\n"
  "    th.group {\n"
  "      text-align: center;\n"
  "    }\n"
  "    td {\n"
  "      text-align: left;\n"
  "      font-family: Consolas, \"DejaVu Sans Mono\", \"Courier New\", Monospace;\n"
  "    }\n"
  "    tbody tr:nth-child(odd) {\n"
  "      background-color: #eeeeee;\n"
  "    }\n"
  "    tbody tr:hover {\n"
  "      background-color: #c0e3eb;\n"
  "    }\n"
  "  </style>\n"
  "  <table id=\"meta\">\n"
  "    <thead>\n"
  "      <tr>\n"
  "        <th>Name</th>\n"
  "        <th>Value</th>\n"
  "      </tr>\n"
  "    </thead>\n"
  "    <tbody>\n"
  ;

  if (print_date()) {
    *stream() <<
    "      <tr>\n"
    "        <td>Date</td>\n"
    "        <td>" << CTime() << "</td>\n"
    "      </tr>\n"
    ;
  }

  if (print_run_time()) {
    *stream() <<
    "      <tr>\n"
    "        <td>Duration</td>\n"
    "        <td>" << TimeSpan(stats->GetTotalRunTime()) << "</td>\n"
    "      </tr>\n"
    ;
  }

  *stream() <<
  "    </tbody>\n"
  "  </table>\n"
  "  <br/>\n"
  "  <table id=\"data\" class=\"tablesorter\">\n"
  "    <thead>\n"
  "      <tr>\n"
  "        <th rowspan=\"2\">Type</th>\n"
  "        <th rowspan=\"2\">Name</th>\n"
  "        <th rowspan=\"2\">Calls</th>\n"
  "        <th colspan=\"4\" class=\"group\">Self Time</th>\n"
  "        <th colspan=\"4\" class=\"group\">Total Time</th>\n"
  "      </tr>\n"
  "      <tr>\n"
  "        <th>%</th>\n"
  "        <th>Overall</th>\n"
  "        <th>Average</th>\n"
  "        <th>Worst</th>\n"
  "        <th>%</th>\n"
  "        <th>Overall</th>\n"
  "        <th>Average</th>\n"
  "        <th>Worst</th>\n"
  "      </tr>\n"
  "    </thead>\n"
  "    <tbody>\n"
  ;

  std::vector<FunctionStatistics*> all_fn_stats;
  stats->GetStatistics(all_fn_stats);

  Nanoseconds self_time_all;
  for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
       iterator != all_fn_stats.end(); ++iterator)
  {
    const FunctionStatistics *fn_stats = *iterator;
    self_time_all += fn_stats->self_time();
  };

  Nanoseconds total_time_all;
  for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
       iterator != all_fn_stats.end(); ++iterator)
  {
    const FunctionStatistics *fn_stats = *iterator;
    total_time_all += fn_stats->total_time();
  };

  std::ostream::fmtflags flags = stream()->flags();
  stream()->flags(flags | std::ostream::fixed);

  for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
       iterator != all_fn_stats.end(); ++iterator)
  {
    const FunctionStatistics *fn_stats = *iterator;

    double self_time_percent = fn_stats->self_time().count() * 100 / self_time_all.count();
    double total_time_percent = fn_stats->total_time().count() * 100 / total_time_all.count();

    double self_time = Seconds(fn_stats->self_time()).count();
    double total_time = Seconds(fn_stats->total_time()).count();

    double avg_self_time = Milliseconds(fn_stats->self_time()).count() / fn_stats->num_calls();
    double avg_total_time = Milliseconds(fn_stats->total_time()).count() / fn_stats->num_calls();

    double worst_self_time = Milliseconds(fn_stats->worst_self_time()).count();
    double worst_total_time = Milliseconds(fn_stats->worst_total_time()).count();

    *stream()
    << "    <tr>\n"
    << "      <td>" << fn_stats->function()->GetTypeString() << "</td>\n"
    << "      <td>" << fn_stats->function()->name() << "</td>\n"
    << "      <td>" << fn_stats->num_calls() << "</td>\n"
    << "      <td>" << std::setprecision(2) << self_time_percent << "%</td>\n"
    << "      <td>" << std::setprecision(1) << self_time << "</td>\n"
    << "      <td>" << std::setprecision(1) << avg_self_time << "</td>\n"
    << "      <td>" << std::setprecision(1) << worst_self_time << "</td>\n"
    << "      <td>" << std::setprecision(2) << total_time_percent << "%</td>\n"
    << "      <td>" << std::setprecision(1) << total_time << "</td>\n"
    << "      <td>" << std::setprecision(1) << avg_total_time << "</td>\n"
    << "      <td>" << std::setprecision(1) << worst_total_time << "</td>\n"
    << "    </tr>\n";
  };

  stream()->flags(flags);

  *stream() <<
  "    </tbody>\n"
  "  </table>\n"
  "</body>\n"
  "</html>\n"
  ;
}
示例#6
0
文件: pk2dft.c 项目: GBert/misc
void print_device(FILE * f, device_ent_t * devpart_par) {
    int j;

    fprintf(f, "part_name                 = \"%s\"\n", devpart_par->part_name);
    fprintf(f, "family                    = \"%s\"\n", family_name(devpart_par->family));
    fprintf(f, "device_id                 = 0x%08x\n", devpart_par->device_id);
    fprintf(f, "program_mem               = 0x%08x\n", devpart_par->program_mem);
    fprintf(f, "ee_mem                    = 0x%04x\n", devpart_par->ee_mem);
    fprintf(f, "ee_addr                   = 0x%08x\n", devpart_par->ee_addr);
    fprintf(f, "config_words              = %d\n", devpart_par->config_words);
    fprintf(f, "config_addr               = 0x%08x\n", devpart_par->config_addr);
    fprintf(f, "user_id_words             = %d\n", devpart_par->user_id_words);
    fprintf(f, "user_id_addr              = 0x%08x\n", devpart_par->user_id_addr);
    fprintf(f, "bandgap_mask              = 0x%08x\n", devpart_par->bandgap_mask);

    fprintf(f, "config_masks              = {");
    for (j = 0; j < 7; j++)
	fprintf(f, "0x%04x, ", devpart_par->config_masks[j]);
    fprintf(f, "0x%04x}\n", devpart_par->config_masks[7]);

    fprintf(f, "config_blank              = {");
    for (j = 0; j < 7; j++)
	fprintf(f, "0x%04x, ", devpart_par->config_blank[j]);
    fprintf(f, "0x%04x}\n", devpart_par->config_blank[7]);

    fprintf(f, "cp_mask                   = 0x%04x\n", devpart_par->cp_mask);
    fprintf(f, "cp_config                 = 0x%04x\n", devpart_par->cp_config);
    fprintf(f, "osscal_save               = %d\n", devpart_par->osscal_save);
    fprintf(f, "ignore_address            = 0x%08x\n", devpart_par->ignore_address);
    fprintf(f, "vdd_min                   = %f\n", devpart_par->vdd_min);
    fprintf(f, "vdd_max                   = %f\n", devpart_par->vdd_max);
    fprintf(f, "vdd_erase                 = %f\n", devpart_par->vdd_erase);
    fprintf(f, "calibration_words         = %d\n", devpart_par->calibration_words);
    fprintf(f, "chip_erase_script         = \"%s\"\n", script_name(devpart_par->chip_erase_script));
    fprintf(f, "progmem_addr_set_script   = \"%s\"\n", script_name(devpart_par->progmem_addr_set_script));
    fprintf(f, "progmem_addr_bytes        = %d\n", devpart_par->progmem_addr_bytes);
    fprintf(f, "progmem_rd_script         = \"%s\"\n", script_name(devpart_par->progmem_rd_script));
    fprintf(f, "progmem_rd_words          = %d\n", devpart_par->progmem_rd_words);
    fprintf(f, "eerd_prep_script          = \"%s\"\n", script_name(devpart_par->eerd_prep_script));
    fprintf(f, "eerd_script               = \"%s\"\n", script_name(devpart_par->eerd_script));
    fprintf(f, "eerd_locations            = %d\n", devpart_par->eerd_locations);
    fprintf(f, "user_id_rd_prep_script    = \"%s\"\n", script_name(devpart_par->user_id_rd_prep_script));
    fprintf(f, "user_id_rd_script         = \"%s\"\n", script_name(devpart_par->user_id_rd_script));
    fprintf(f, "config_rd_prep_script     = \"%s\"\n", script_name(devpart_par->config_rd_prep_script));
    fprintf(f, "config_rd_script          = \"%s\"\n", script_name(devpart_par->config_rd_script));
    fprintf(f, "progmem_wr_prep_script    = \"%s\"\n", script_name(devpart_par->progmem_wr_prep_script));
    fprintf(f, "progmem_wr_script         = \"%s\"\n", script_name(devpart_par->progmem_wr_script));
    fprintf(f, "progmem_wr_words          = %d\n", devpart_par->progmem_wr_words);
    fprintf(f, "progmem_panel_bufs        = %d\n", devpart_par->progmem_panel_bufs);
    fprintf(f, "progmem_panel_offset      = %d\n", devpart_par->progmem_panel_offset);
    fprintf(f, "eewr_prep_script          = \"%s\"\n", script_name(devpart_par->eewr_prep_script));
    fprintf(f, "eewr_script               = \"%s\"\n", script_name(devpart_par->eewr_script));
    fprintf(f, "eewr_locations            = %d\n", devpart_par->eewr_locations);
    fprintf(f, "user_id_wr_prep_script    = \"%s\"\n", script_name(devpart_par->user_id_wr_prep_script));
    fprintf(f, "user_id_wr_script         = \"%s\"\n", script_name(devpart_par->user_id_wr_script));
    fprintf(f, "config_wr_prep_script     = \"%s\"\n", script_name(devpart_par->config_wr_prep_script));
    fprintf(f, "config_wr_script          = \"%s\"\n", script_name(devpart_par->config_wr_script));
    fprintf(f, "osccal_rd_script          = \"%s\"\n", script_name(devpart_par->osccal_rd_script));
    fprintf(f, "osccal_wr_script          = \"%s\"\n", script_name(devpart_par->osccal_wr_script));
    fprintf(f, "dp_mask                   = 0x%04x\n", devpart_par->dp_mask);
    fprintf(f, "write_cfg_on_erase        = %d\n", devpart_par->write_cfg_on_erase);
    fprintf(f, "blank_check_skip_usr_ids  = %d\n", devpart_par->blank_check_skip_usr_ids);
    fprintf(f, "ignore_bytes              = %d\n", devpart_par->ignore_bytes);
    fprintf(f, "chip_erase_prep_script    = \"%s\"\n", script_name(devpart_par->chip_erase_prep_script));
    fprintf(f, "boot_flash                = %d\n", devpart_par->boot_flash);
    fprintf(f, "config9_mask              = 0x%04x\n", devpart_par->config9_mask);
    fprintf(f, "config9_blank             = 0x%04x\n", devpart_par->config9_blank);
    fprintf(f, "progmem_erase_script      = \"%s\"\n", script_name(devpart_par->progmem_erase_script));
    fprintf(f, "eemem_erase_script        = \"%s\"\n", script_name(devpart_par->eemem_erase_script));
    fprintf(f, "configmem_erase_script    = \"%s\"\n", script_name(devpart_par->configmem_erase_script));
    fprintf(f, "reserved1_erase_script    = \"%s\"\n", script_name(devpart_par->reserved1_erase_script));
    fprintf(f, "reserved2_erase_script    = \"%s\"\n", script_name(devpart_par->reserved2_erase_script));
    fprintf(f, "test_memory_rd_script     = \"%s\"\n", script_name(devpart_par->test_memory_rd_script));
    fprintf(f, "test_memory_rd_words      = %d\n", devpart_par->test_memory_rd_words);
    fprintf(f, "eerow_erase_script        = \"%s\"\n", script_name(devpart_par->eerow_erase_script));
    fprintf(f, "eerow_erase_words         = %d\n", devpart_par->eerow_erase_words);
    fprintf(f, "export_to_mplab           = %d\n", devpart_par->export_to_mplab);
    fprintf(f, "debug_halt_script         = \"%s\"\n", script_name(devpart_par->debug_halt_script));
    fprintf(f, "debug_run_script          = \"%s\"\n", script_name(devpart_par->debug_run_script));
    fprintf(f, "debug_status_script       = \"%s\"\n", script_name(devpart_par->debug_status_script));
    fprintf(f, "debug_read_exec_ver_script= \"%s\"\n", script_name(devpart_par->debug_read_exec_ver_script));
    fprintf(f, "debug_single_step_script  = \"%s\"\n", script_name(devpart_par->debug_single_step_script));
    fprintf(f, "debug_bulk_wr_data_script = \"%s\"\n", script_name(devpart_par->debug_bulk_wr_data_script));
    fprintf(f, "debug_bulk_rd_data_script = \"%s\"\n", script_name(devpart_par->debug_bulk_rd_data_script));
    fprintf(f, "debug_write_vector_script = \"%s\"\n", script_name(devpart_par->debug_write_vector_script));
    fprintf(f, "debug_read_vector_script  = \"%s\"\n", script_name(devpart_par->debug_read_vector_script));
    fprintf(f, "debug_row_erase_script    = \"%s\"\n", script_name(devpart_par->debug_row_erase_script));
    fprintf(f, "debug_row_erase_size      = %d\n", devpart_par->debug_row_erase_size);
    fprintf(f, "debug_reserved5_script    = \"%s\"\n", script_name(devpart_par->debug_reserved5_script));
    fprintf(f, "debug_reserved6_script    = \"%s\"\n", script_name(devpart_par->debug_reserved6_script));
    fprintf(f, "debug_reserved7_script    = \"%s\"\n", script_name(devpart_par->debug_reserved7_script));
    fprintf(f, "debug_reserved8_script    = \"%s\"\n", script_name(devpart_par->debug_reserved8_script));
    fprintf(f, "lvp_script                = \"%s\"\n", script_name(devpart_par->lvp_script));
}
示例#7
0
//	Created 	: 01.04.2004
//  Modified 	: 01.04.2004
//	Author		: Dmitriy Iassenev
//	Description : XRay Script Storage
////////////////////////////////////////////////////////////////////////////

#include "pch_script.h"
#include "script_storage.h"
#include "script_thread.h"
#include <stdarg.h>
#include "doug_lea_memory_allocator.h"
#include "../lua_tools.h"
#include "../../build_config_defines.h"

LPCSTR	file_header_old = "\
local function script_name() \
return \"%s\" \
end \
local this = {} \
%s this %s \
setmetatable(this, {__index = _G}) \
setfenv(1, this) \
		";

LPCSTR	file_header_new = "\
local function script_name() \
return \"%s\" \
end \
local this = {} \
this._G = _G \
%s this %s \
void StatisticsWriterHtml::Write(const Statistics *stats)
{
	*stream() <<
	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n"
	"\"http://www.w3.org/TR/html4/loose.dtd\">\n"
	"<html>\n"
	"<head>\n"
	"	<title>" << "Profile of '" << script_name() << "'</title>\n"
	"</head>\n"
	"<body>\n";

	*stream() <<
	"	<style type=\"text/css\">\n"
	"	table.meta {\n"
	"		width: auto;\n"
	"	}\n"
	"	table {\n"
	"		border-spacing:0;\n"
	"		border-collapse: collapse;\n"
	"	}\n"
	"	table, th, td {\n"
	"		border: 1px solid #cccccc;\n"
	"	}\n"
	"	td {\n"
	"		font-family: Consolas, \"Courier New\", \"Monospace\";\n"
	"		border: solid 5x transparent;\n"
	"	}\n"
	"	th {\n"
	"		background-color: #cccccc;\n"
	"	}\n"
	"	</style>\n"
	"	<table class=\"meta\" border=\"1\">\n"
	"		<thead>\n"
	"			<tr>\n"
	"				<th>Name</th>\n"
	"				<th>Value</th>\n"
	"			</tr>\n"
	"		</thead>\n"
	"		<tbody>\n";

	if (print_date()) {
		*stream() <<
		"			<tr>\n"
		"				<td>Date</td>\n"
		"				<td>" << CTime() << "</td>\n"
		"			</tr>\n";
	}

	if (print_run_time()) {
		*stream() <<
		"			<tr>\n"
		"				<td>Duration</td>\n"
		"				<td>" << TimeSpan(stats->GetTotalRunTime()) << "</td>\n"
		"			</tr>\n";
	}

	*stream() <<
	"		</tbody>\n"
	"	</table>\n"
	"	<br/>"
	"	<style type=\"text/css\">\n"
	"	tr:nth-child(odd) {\n"
	"		background-color: #eeeeee;\n"
	"	}\n"
	"	</style>\n"
	"	<table id=\"func-stats\" class=\"tablesorter\" border=\"1\" width=\"100%\">\n"
	"		<thead>\n"
	"			<tr>\n"
	"				<th>Type</th>\n"
	"				<th>Name</th>\n"
	"				<th>Calls</th>\n"
	"				<th colspan=\"2\">Self Time</th>\n"
	"				<th colspan=\"2\">Total Time</th>\n"
	"				<th>Best time</th>\n"
	"				<th>Worst time</th>\n"
	"				<th>Average time</th>\n"
	"			</tr>\n"
	"		</thead>\n"
	"		<tbody>\n"
	;

	std::vector<FunctionStatistics*> all_fn_stats;
	stats->GetStatistics(all_fn_stats);

	Nanoseconds time_all;
	for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
			iterator != all_fn_stats.end(); ++iterator)
	{
		const FunctionStatistics *fn_stats = *iterator;
		time_all += fn_stats->total_time() - fn_stats->child_time(); 
	};

	Nanoseconds total_time_all;
	for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
			iterator != all_fn_stats.end(); ++iterator)
	{
		const FunctionStatistics *fn_stats = *iterator;
		total_time_all += fn_stats->total_time(); 
	};

	for (std::vector<FunctionStatistics*>::const_iterator iterator = all_fn_stats.begin();
			iterator != all_fn_stats.end(); ++iterator)
	{
		const FunctionStatistics *fn_stats = *iterator;

		double self_time_sec = Seconds(fn_stats->GetSelfTime()).count();
		double self_time_percent = fn_stats->GetSelfTime().count() * 100 / time_all.count();

		double total_time_sec = Seconds(fn_stats->total_time()).count();
		double total_time_percent = fn_stats->total_time().count() * 100 / total_time_all.count();

		double best_time_sec = Seconds(fn_stats->best_time()).count();
		double worst_time_sec = Seconds(fn_stats->worst_time()).count();
		double average_time_sec = Seconds(fn_stats->average_time()).count();

		*stream()
		<< "		<tr>\n"
		<< "			<td>" << fn_stats->function()->type() << "</td>\n"
		<< "			<td>" << fn_stats->function()->name() << "</td>\n"
		<< "			<td>" << fn_stats->num_calls() << "</td>\n"
		<< "			<td>" << std::fixed << std::setprecision(2) << self_time_percent << "%</td>\n"
		<< "			<td>" << std::fixed << std::setprecision(3) << self_time_sec << "s</td>\n"
		<< "			<td>" << std::fixed << std::setprecision(2) << total_time_percent << "%</td>\n"
		<< "			<td>" << std::fixed << std::setprecision(3) << total_time_sec << "s</td>\n"
		<< "			<td>" << std::fixed << std::setprecision(3) << best_time_sec << "s</td>\n"
		<< "			<td>" << std::fixed << std::setprecision(3) << worst_time_sec << "s</td>\n"
		<< "			<td>" << std::fixed << std::setprecision(3) << average_time_sec << "s</td>\n"
		<< "			</td>\n"
		<< "		</tr>\n";
	};

	*stream() <<
	"		</tbody>\n"
	"	</table>\n"
	;

	*stream() <<
	"	<script type=\"text/javascript\"\n"
	"		src=\"http://code.jquery.com/jquery-latest.min.js\"></script>\n"
	"	<script type=\"text/javascript\"\n"
	"		src=\"http://tablesorter.com/__jquery.tablesorter.min.js\"></script>\n"
	"	<script type=\"text/javascript\">\n"
	"	$(document).ready(function() {\n"
	"		$(\"#func-stats\").tablesorter();\n"
	"	});\n"
	"	</script>\n"
	"	<br/>\n"
	"	<footer>\n"
	;

	*stream() <<
	"	</footer>\n"
	"</body>\n"
	"</html>\n"
	;
}
示例#9
0
        //connect(event_manager::get_instance(),SIGNAL(analogSet_component_changed(int)),this,SLOT(slot_set_value_changed(int)));
        //connect(event_manager::get_instance(),SIGNAL(newAnalogValue(int)),this,SLOT(slot_newAnalogValue(int)));
        connect(event_manager::get_instance(),SIGNAL(abort_script()),this,SLOT(slot_abort_script()));
        connect(this,SIGNAL(script_finished()),event_manager::get_instance(),SIGNAL(script_finished()));

        foreach (int ent, entity_manager::get_instance()->get_all_ScriptableObjects()) {
            slot_register_scritable_component(ent);
        }

        //connect(event_manager::get_instance(),SIGNAL(register_scritable_component(int)),this,SLOT(slot_register_scritable_component(int)));
        //connect(event_manager::get_instance(),SIGNAL(unregister_scritable_component(int)),this,SLOT(slot_unregister_scritable_component(int)));
        connect(event_manager::get_instance(),SIGNAL(newScriptableObject(int)),this, SLOT(slot_register_scritable_component(int)));


        m_set_hdl = new script_set_handler();
        entity_manager::get_instance()->createScriptableObject(m_set_hdl->script_name(), m_set_hdl);

        m_act_hdl = new script_act_handler();
        entity_manager::get_instance()->createScriptableObject(m_act_hdl->script_name(), m_act_hdl);

        m_diag_hdl = new script_dialoges_handler();
        connect(this, SIGNAL(abort_all_dialoges()),m_diag_hdl,SIGNAL(dialog_finished()));
        entity_manager::get_instance()->createScriptableObject(m_diag_hdl->script_name(), m_diag_hdl);

        m_util_hdl = new script_util_handler();
        //connect(this, SIGNAL(abort_all_dialoges()),m_util_hdl,SIGNAL(dialog_finished()));
        entity_manager::get_instance()->createScriptableObject(m_util_hdl->script_name(), m_util_hdl);

        m_log_hdl = new script_log_handler();
        entity_manager::get_instance()->createScriptableObject(m_log_hdl->script_name(), m_log_hdl);
示例#10
0
  printf ("&quot;</div>\n");

  ident_destroy (ident);
  return (0);
} /* }}} int show_breadcrump */

static int show_time_selector (__attribute__((unused)) void *user_data) /* {{{ */
{
  param_list_t *pl;

  pl = param_create (/* query string = */ NULL);
  param_set (pl, "begin", NULL);
  param_set (pl, "end", NULL);
  param_set (pl, "button", NULL);

  printf ("<form action=\"%s\" method=\"get\">\n", script_name ());

  param_print_hidden (pl);

  printf ("  <select name=\"begin\">\n"
      "    <option value=\"-3600\">Hour</option>\n"
      "    <option value=\"-86400\">Day</option>\n"
      "    <option value=\"-604800\">Week</option>\n"
      "    <option value=\"-2678400\">Month</option>\n"
      "    <option value=\"-31622400\">Year</option>\n"
      "  </select><br />\n");
  printf ("  <input id=\"format-json\" type=\"radio\" name=\"format\" value=\"JSON\" checked=\"checked\" />"
      "<label for=\"format-json\">&nbsp;JavaScript</label><br />\n"
      "  <input id=\"format-rrd\" type=\"radio\" name=\"format\" value=\"RRD\" />"
      "<label for=\"format-rrd\">&nbsp;RRDtool</label>\n<br />");
  printf ("  <input type=\"submit\" name=\"button\" value=\"Go\" />\n");
示例#11
0
static void
dump_runs (PangoLayout *layout, GString *string)
{
  PangoLayoutIter *iter;
  PangoLayoutRun *run;
  PangoItem *item;
  const gchar *text;
  gint index, index2;
  gboolean has_more;
  gchar *char_str;
  gint i;
  gchar *font;

  text = pango_layout_get_text (layout);
  iter = pango_layout_get_iter (layout);

  has_more = TRUE;
  index = pango_layout_iter_get_index (iter);
  i = 0;
  while (has_more)
    {
      run = pango_layout_iter_get_run (iter);
      has_more = pango_layout_iter_next_run (iter);
      i++;

      if (has_more)
        {
          index2 = pango_layout_iter_get_index (iter);
          char_str = g_strndup (text + index, index2 - index);          
        }
      else
        {
          char_str = g_strdup (text + index);
        }

      if (run)
        {
          item = ((PangoGlyphItem*)run)->item;
          font = font_name (item->analysis.font);
          g_string_append_printf (string, "i=%d, index=%d, chars=%d, level=%d, gravity=%s, flags=%d, font=%s, script=%s, language=%s, '%s'\n",
                                  i, index, item->num_chars, item->analysis.level,
                                  gravity_name (item->analysis.gravity),
                                  item->analysis.flags,
                                  "OMITTED", /* for some reason, this fails on build.gnome.org, so leave it out */
                                  script_name (item->analysis.script),
                                  pango_language_to_string (item->analysis.language),
                                  char_str);
          dump_extra_attrs (item->analysis.extra_attrs, string);
          g_free (font);
        }
      else
        {
          g_string_append_printf (string, "i=%d, index=%d, no run, line end\n",
                                  i, index);
        }

      g_free (char_str);
      index = index2;
    }
  pango_layout_iter_free (iter);
}