Ejemplo n.º 1
0
int
main(int argc, const char* argv[])
{
  if (argc != 4) {
    std::cerr << "Usage: " << argv[0] << " system_xml_directory private_xml_directory command" << std::endl
              << std::endl
              << "Example: " << argv[0]
              << " /Applications/KeyRemap4MacBook.app/Contents/Resources"
              << " ~/Library/Application\\ Support/KeyRemap4MacBook"
              << " dump_data"
              << std::endl;
    exit(1);
  }

  pqrs::xml_compiler xml_compiler(argv[1], argv[2]);
  xml_compiler.reload();
  if (xml_compiler.get_error_information().get_count() > 0) {
    std::cerr << xml_compiler.get_error_information().get_message() << std::endl;
    exit(1);
  }

  std::string command(argv[3]);

  if (command == "dump_data") {
    auto v = xml_compiler.get_remapclasses_initialize_vector().get();
    for (auto& it : v) {
      std::cout << it << std::endl;
    }

  } else if (command == "dump_tree") {
    dump_tree(xml_compiler.get_preferences_checkbox_node_tree(), false);
    std::cout << std::endl;
    std::cout << std::endl;
    std::cout << "Total items: " << total_identifier_count_ << std::endl;

  } else if (command == "dump_tree_all") {
    dump_tree(xml_compiler.get_preferences_checkbox_node_tree(), true);
    std::cout << std::endl;
    std::cout << std::endl;
    std::cout << "Total items: " << total_identifier_count_ << std::endl;

  } else if (command == "dump_number") {
    dump_number(xml_compiler.get_preferences_number_node_tree());

  } else if (command == "dump_identifier_except_essential") {
    for (int i = 0;; ++i) {
      auto identifier = xml_compiler.get_identifier(i);
      if (! identifier) break;

      std::cout << *identifier << std::endl;
    }

  } else if (command == "dump_symbol_map") {
    xml_compiler.debug_dump_symbol_map();

  } else if (command == "output_bridge_essential_configuration_enum_h") {
    std::cout << "enum {" << std::endl;

    for (size_t i = 0;; ++i) {
      auto essential_configuration = xml_compiler.get_essential_configuration(i);
      if (! essential_configuration) {
        std::cout << "BRIDGE_ESSENTIAL_CONFIG_INDEX__END__ = " << i << std::endl;
        break;
      }

      std::cout << "BRIDGE_ESSENTIAL_CONFIG_INDEX_" << essential_configuration->get_identifier()
                << " = " << i << ","
                << std::endl;
    }

    std::cout << "};" << std::endl;

  } else if (command == "output_bridge_essential_configuration_default_values_c") {
    for (size_t i = 0;; ++i) {
      auto essential_configuration = xml_compiler.get_essential_configuration(i);
      if (! essential_configuration) {
        break;
      }
      std::cout << essential_configuration->get_default_value()
                << ","
                << std::endl;
    }

  } else if (command == "output_bridge_essential_configuration_identifiers_m") {
    for (size_t i = 0;; ++i) {
      auto essential_configuration = xml_compiler.get_essential_configuration(i);
      if (! essential_configuration) {
        std::cout << "nil" << std::endl;
        break;
      }

      std::cout << "@\"" << essential_configuration->get_raw_identifier() << "\""
                << ","
                << std::endl;
    }
  }

  return 0;
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: taysom/tau
int pp (int argc, char *argv[])
{
	dump_tree( &Tree);
	return 0;
}
Ejemplo n.º 3
0
//Recusively dumping SCOPE trees.
void dump_scope(SCOPE * s, UINT flag)
{
	if (g_tfile == NULL) return;
	static CHAR buf[8192];
	buf[0] = 0;
	note("\nSCOPE(id:%d, level:%d)", SCOPE_id(s), SCOPE_level(s));
	g_indent++;
	
	//symbols
	SYM_LIST * sym_list = SCOPE_sym_tab_list(s);
	if (sym_list != NULL) {
		note("\nSYMBAL:");
		g_indent++;
		note("\n");
		while (sym_list != NULL) {
			note("%s\n", SYM_name(SYM_LIST_sym(sym_list)));
			sym_list = SYM_LIST_next(sym_list);
		}
		g_indent--;
	}

	//all of defined customer label in code
	LABEL_INFO * li = SCOPE_label_list(s).get_head(); 
	if (li != NULL) {
		note("\nDEFINED LABEL:");		
		g_indent++;
		note("\n");
		for (; li != NULL; li = SCOPE_label_list(s).get_next()) { 
			IS_TRUE0(map_lab2lineno(li) != 0);
			note("%s (def in line:%d)\n",
				 SYM_name(LABEL_INFO_name(li)),
				 map_lab2lineno(li));
		}
		g_indent--;
	}

	//refered customer label in code
	li = SCOPE_ref_label_list(s).get_head(); 
	if (li != NULL) {
		note("\nREFED LABEL:");
		g_indent++;		
		note("\n");
		for (; li != NULL; li = SCOPE_ref_label_list(s).get_next()) { 
			note("%s (use in line:%d)\n", 
				 SYM_name(LABEL_INFO_name(li)),
				 map_lab2lineno(li));
		}
		g_indent--;
	}

	//enums
	ENUM_LIST * el = SCOPE_enum_list(s);
	if (el != NULL) {
		note("\nENUM LIST:");
		g_indent++;
		note("\n");
		while (el != NULL) {
			buf[0] = 0;
			format_enum_complete(buf, ENUM_LIST_enum(el));
			note("%s\n", buf);
			el = ENUM_LIST_next(el);
		}
		g_indent--;
	}

	//user defined type, by 'typedef'
	USER_TYPE_LIST * utl = SCOPE_user_type_list(s);
	if (utl != NULL) {
		note("\nUSER TYPE:");
		g_indent++;	
		note("\n");
		while (utl != NULL) {
			buf[0] = 0;
			format_user_type_spec(buf, USER_TYPE_LIST_utype(utl));
			note("%s\n", buf);
			utl = USER_TYPE_LIST_next(utl);
		}
		g_indent--;
	}

	//structs
	STRUCT * st = SCOPE_struct_list(s);
	if (st != NULL) {
		note("\nSTRUCT:");
		g_indent++;	
		note("\n");
		while (st != NULL) {
			buf[0] = 0;
			format_struct_complete(buf, st);
			note("%s\n", buf);
			st = USER_TYPE_LIST_next(st);
		}
		g_indent--;
	}

	//unions
	UNION * un = SCOPE_union_list(s);
	if (un != NULL) {
		note("\nUNION:");
		g_indent++;
		note("\n");
		while (un != NULL) {
			buf[0] = 0;
			format_union_complete(buf, un);
			note("%s\n", buf);
			un = USER_TYPE_LIST_next(un);
		}
		g_indent--;
	}

	//declarations
	DECL * dcl = SCOPE_decl_list(s);
	if (dcl != NULL) {
		note("\nDECLARATIONS:");
		note("\n");
		g_indent++;
		while (dcl != NULL) {
			buf[0] = 0;
			format_declaration(buf, dcl);
			note("%s", buf);
			dump_decl(dcl);

			//Dump function body
			if (DECL_is_fun_def(dcl) && HAVE_FLAG(flag, DUMP_SCOPE_FUNC_BODY)) {
				g_indent += 2;
				dump_scope(DECL_fun_body(dcl), flag);
				g_indent -= 2;
			}

			//Dump initializing value/expression.
			if (DECL_is_init(DECL_decl_list(dcl))) {
				note("= ");
				g_indent += 2;
				dump_tree(DECL_init_tree(DECL_decl_list(dcl)));
				g_indent -= 2;
			}
			
			note("\n");
			dcl = DECL_next(dcl);
		}
		g_indent--;
	}
	fflush(g_tfile);

	if (HAVE_FLAG(flag, DUMP_SCOPE_STMT_TREE)) {
		TREE * t = SCOPE_stmt_list(s);
		if (t != NULL) {
			note("\nSTATEMENT:");
			g_indent++;	
			note("\n");
			dump_trees(t);	
			g_indent--;
		}
	}
	g_indent--;
}
inline void AdaptiveHuffmanTree<type>::dump_tree() const {
	dump_tree(tree_root);
	std::cout << std::endl;
}
Ejemplo n.º 5
0
/* Check */

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#include <parse_tree.h>
#include <aurochs.h>

static unsigned char *load_file(char *name, size_t *size)/*{{{*/
{
  size_t m;
  struct stat st;
  unsigned char *data;
  FILE *f;
  unsigned char *retval;

  retval = 0;
  
  if(!stat(name, &st)) {
    m = st.st_size;
    *size = m;
    data = malloc(m);
    if(data) {
      f = fopen(name, "rb");
      if(f) {
        if(1 == fread(data, m, 1, f)) {
          retval = data;
          data = 0;
        }
        fclose(f);
      }
      if(data) free(data);
    }
  }

  return retval;
}/*}}}*/
int main(int argc, char **argv)
{
  unsigned char *peg_data;
  char *peg_fn;
  size_t peg_data_size;
  nog_program_t *pg;
  packer_t pk;
  staloc_t *st;
  int rc;

  rc = 0;

  argv ++; argc --;

  if(!argc) {
    printf("No PEG data\n");
    exit(EXIT_FAILURE);
  }

  peg_fn = *(argv ++); argc --;
  printf("Loading peg_data from file %s\n", peg_fn);

  peg_data = load_file(peg_fn, &peg_data_size);
  if(!peg_data) {
    printf("Can't load peg data.\n");
    exit(EXIT_FAILURE);
  }

  /* Create a stack allocator */

  st = staloc_create(&alloc_stdlib);
  if(!st) {
    printf("Can't create stack allocator.\n");
    exit(EXIT_FAILURE);
  }

  if(pack_init_from_string(&pk, peg_data, peg_data_size)) {
    printf("peg_data[0] = %d\n", peg_data[0]);
    pg = nog_unpack_program(&st->s_alloc, &pk);
    printf("Unpacked to %p\n", pg);
    if(pg) {
      peg_context_t *cx;
      size_t m;
      int i;
      int error_pos;
      char *fn;
      unsigned char *buf;
      int rc;

      rc = 0;

      for(i = 0; i < argc; i ++) {
        fn = argv[i];
        peg_builder_t pb;
        staloc_t *s2;

        s2 = staloc_create(&alloc_stdlib);

        buf = load_file(fn, &m);
        printf("Loaded file %s to %p\n", fn, buf);
        if(buf) {
          ptree_init(&pb, &s2->s_alloc);
          cx = peg_create_context(&alloc_stdlib, pg, &pb, &s2->s_alloc, buf, m);
          printf("Created context %p\n", cx);
          if(cx) {
            tree tr;

            if(nog_execute(cx, pg, &tr)) {
              printf("Parsed as %p.\n", tr);
              ptree_dump_tree(cx->cx_builder_info, stdout, buf, tr, 0);
            } else {
              printf("Doesn't parse.\n");
              error_pos = nog_error_position(cx, pg);
              printf("Error at %d\n", error_pos);
            }

            peg_delete_context(cx);
          }
        }
        staloc_dispose(s2);
        free(buf);
      }
#if 0
        i = foobar_parse_start(cx, - m);
        if(getenv("DUMP_CONTEXT")) dump_context(stdout, cx);

        if(!i) {
          printf("%05d RESULT OK\n", count);
          tree *tr0;

          if(getenv("DUMP_TREE"))
          {
            tr0 = create_node("Root");
            (void) foobar_build_start(cx, &tr0->t_element.t_node, -m);
            reverse_tree(tr0);
            dump_tree(stdout, cx->cx_input, tr0, 0);
          }
        } else {
          error_pos = error_position(cx);
          if(i > 0) {
            printf("%05d RESULT NOPREFIX; ERROR AT %d\n", count, error_pos);
            rc = 1;
          } else {
            printf("%05d RESULT PREFIX %d; ERROR AT %d\n", count, m + i, error_pos);
          }
        }
        fflush(stdout);
        delete_context(cx);
        fclose(f);
      }
#endif

      /* nog_free_program(&st->s_alloc, pg); */
      staloc_dispose(st);
    }
  }
Ejemplo n.º 6
0
static void
dump_tree (const tree_cell * c, int n, int idx)
{
  int i;

  if (c == NULL)
    return;

  prefix (n, idx);

  if (c == FAKE_CELL)
    {
      puts ("* FAKE *");
      return;
    }

  if (c->line_nb > 0)
    printf ("L%d: ", c->line_nb);

#if 0
  if ((int) c < 0x1000)
    {
      printf ("* INVALID PTR 0x%x *\n", (int) c);
      return;
    }
#endif
  if (c->type < 0 || c->type >= sizeof (node_names) / sizeof (node_names[0]))
    printf ("* UNKNOWN %d (0x%x)*\n", c->type, c->type);
  else
    printf ("%s (%d)\n", node_names[c->type], c->type);


  prefix (n, idx);
  printf ("Ref_count=%d", c->ref_count);
  if (c->size > 0)
    {
      /*prefix(n, idx); */
      printf ("\tSize=%d (0x%x)", c->size, c->size);
    }
  putchar ('\n');

  switch (c->type)
    {
    case CONST_INT:
      prefix (n, 0);
      printf ("Val=%d\n", c->x.i_val);
      break;

    case CONST_STR:
    case CONST_DATA:
    case NODE_VAR:
    case NODE_FUN_DEF:
    case NODE_FUN_CALL:
    case NODE_DECL:
    case NODE_ARG:
    case NODE_ARRAY_EL:
    case ARRAY_ELEM:
      prefix (n, 0);
      if (c->x.str_val == NULL)
        printf ("Val=(null)\n");
      else
        printf ("Val=\"%s\"\n", c->x.str_val);
      break;
    case REF_VAR:
      prefix (n, 0);
      if (c->x.ref_val == NULL)
        printf ("Ref=(null)\n");
      else
        {
          named_nasl_var *v = c->x.ref_val;
          printf ("Ref=(type=%d, name=%s, value=%s)\n", v->u.var_type,
                  v->var_name != NULL ? v->var_name : "(null)",
                  var2str (&v->u));
        }
      break;

    case REF_ARRAY:
    case DYN_ARRAY:
      break;
    }

  for (i = 0; i < 4; i++)
    {
      dump_tree (c->link[i], n + 3, i + 1);
    }
}
Ejemplo n.º 7
0
/*****************************************************************************
 * NAME
 *    main
 * ARGUMENTS
 *    argc -
 *    argv -
 * DESCRIPTION
 *
 * RETURN VALUE
 *
 */
int main(int argc, char ** argv)
{
char buffer[128];
char * p;
unsigned long value, size, type, prior;
unsigned long num = 0L;
unsigned long allocated = 0L;
unsigned long maxallocated = 0L;
struct treenode * t;
struct allocated * ap, * prevap;

unsigned cAdd = 0;
unsigned cReplace = 0;
unsigned cRemove = 0;

int k;
int fQuiet = FALSE;
while ((k = getopt(argc, argv, "q")) != EOF)
	{
	switch (k)
	{
	case 'q':
		fQuiet = TRUE;
		break;
	}
	}


while (fgets(buffer, 128, stdin) != NULL)
	{
	if ((++num % 1000) == 0)
	fprintf(stderr, "%lu\r", num);
	if (strncmp(buffer, "m ", 2) == 0)
	{
	size = strtoul(buffer+2, &p, 10);
	value = strtoul(p+1, &p, 16);
add_node:
	++cAdd;
	allocated += size;
	if (allocated > maxallocated)
		maxallocated = allocated;
	t = find_node(value);
	if (t == NULL)
		{
		fprintf(stderr, "find_node(value = %lu) [1] failed!\n", value);
		break;
		}
	ap = malloc(sizeof(struct allocated));
	if (ap == NULL)
		{
		fprintf(stderr, "Out of memory!\n");
		break;
		}
	ap->size = size;
	ap->type = MYALLOC;
	ap->line = num;
	ap->link = t->alloc;
	t->alloc = ap;
#ifdef DEBUG
	printf("Adding malloc(%8lu) %8lu [%ld]\n", size, value, num);
#endif
	}
	else if (strncmp(buffer, "r ", 2) == 0)
	{
	prior = strtoul(buffer+2, &p, 16);
	size = strtoul(p+1, &p, 10);
	value = strtoul(p+1, &p, 16);
	if (prior == 0L)
		goto add_node;
replace_node:
	++cReplace;
	t = find_node(prior);
	if (t == NULL)
		{
		fprintf(stderr, "find_node(prior = %lu) failed!\n", value);
		break;
		}
	for ( prevap = NULL, ap = t->alloc ; ap ; ap = ap->link )
		{
		if (ap->type != MYFREE)
		{
		if (prevap == NULL)
			t->alloc = ap->link;
		else
			prevap->link = ap->link;
		allocated -= ap->size;
		free(ap);
#ifdef DEBUG
		printf("Removing malloc() %8lu [realloc:%ld]\n", prior, num);
#endif
		break;
		}
		prevap = ap;
		}
	t = find_node(value);
	if (t == NULL)
		{
		fprintf(stderr, "find_node(value = %lu) [2] failed!\n", value);
		break;
		}
	ap = malloc(sizeof(struct allocated));
	if (ap == NULL)
		{
		fprintf(stderr, "Out of memory!\n");
		break;
		}
	allocated += size;
	if (allocated > maxallocated)
		maxallocated = allocated;
	ap->size = size;
	ap->type = MYALLOC;
	ap->line = num;
	ap->link = t->alloc;
	t->alloc = ap;
#ifdef DEBUG
	printf("Adding malloc(%8lu) %8lu [realloc:%ld]\n", size, value, num);
#endif
	}
	else if (strncmp(buffer, "f ", 2) == 0)
	{
	value = strtoul(buffer+2, &p, 16);
	size = 0L;
	type = MYFREE;
remove_node:
	++cRemove;
	t = find_node(value);
	if (t == NULL)
		{
		fprintf(stderr, "find_node(value = %lu) [3] failed!\n", value);
		break;
		}
	for ( prevap = NULL, ap = t->alloc ; ap ; ap = ap->link )
		{
		if (ap->type != MYFREE)
		{
		if (prevap == NULL)
			t->alloc = ap->link;
		else
			prevap->link = ap->link;
		allocated -= ap->size;
		free(ap);
#ifdef DEBUG
		printf("Removing malloc() %8lu [%ld] [free]\n", value, num);
#endif
		break;
		}
		prevap = ap;
		}
	if (ap == NULL)
		{
		ap = malloc(sizeof(struct allocated));
		if (ap == NULL)
		{
		fprintf(stderr, "Out of memory!\n");
		break;
		}
		ap->size = size;
		ap->type = MYFREE;
		ap->line = num;
		ap->link = t->alloc;
		t->alloc = ap;
#ifdef DEBUG
		printf("Adding free(%8lu) [%ld]\n", value, num);
#endif
		}
	}
	}
fprintf(stderr, "%lu\n", num);
if (!fQuiet)
	print_tree( &head );
if (cAdd != cRemove)
	printf("%u alloc, %u realloc, %u free\n", cAdd, cReplace, cRemove);
printf("%lu still allocated, %lu max allocated\n", allocated, maxallocated);
#ifdef DEBUG
dump_tree( &head, 0 );
#endif
return 0;
}
Ejemplo n.º 8
0
void dump_filemap (info_s *file)
{
	dump_tree( &file->in_tree);
}
Ejemplo n.º 9
0
int main(){
	
	tree_t * tree = init_tree(100);
	iterator_t* it = it_init(NULL);
	it = it_init(tree);
	it_left(it);
	it_right(it);
	
	it_current(NULL);
	it_up(NULL);
	it_right(NULL);
	it_left(NULL);
	
	
	insert_item(NULL, 0, it, RIGHT);
	insert_item(tree, 200, it, 10);
	
	insert_item(tree, 30, it, LEFT);
	insert_item(tree, 40, it, RIGHT);
	insert_item(tree, 20, it, LEFT);
	
	it_right(it);
	it_left(it);
	insert_item(tree, 100500, it, RIGHT);
	insert_item(tree, 10, it, RIGHT);
	insert_item(tree, 25, it, LEFT);
	it_right(it);
	dump_tree(NULL);
	dump_tree(tree);
	
	foreach_t* iter = foreach_init(NULL);
	for (iter = foreach_init(tree); !foreach_isEnd(iter); foreach_next(iter)){
		//printf("%i/%i:%i\n",iter->i, iter->nnodes, foreach_current(iter));
		printf("%i\n",foreach_current(iter));
	}
	printf("\n");
	foreach_delete(iter);
	
	delete_item(tree, NULL);
	
	printf("current = %i\n", it_current(it));
	it_up(it);
	it_left(it);
	printf("current = %i\n", it_current(it));
	dump_tree(tree);
	delete_item(tree, it);
	printf("current = %i\n", it_current(it));
	dump_tree(tree);
	it_right(it);
	delete_item(tree, it);
	dump_tree(tree);
	
	for (iter = foreach_init(tree); !foreach_isEnd(iter); foreach_next(iter)){
		//printf("%i/%i:%i\n",iter->i, iter->nnodes, foreach_current(iter));
		printf("%i\n",foreach_current(iter));
	}
	printf("\n");
		
	delete_tree(NULL);
	delete_tree(tree);
	
	it_delete(it);
	it_delete(NULL);
	
	foreach_delete(NULL);
	foreach_delete(iter);
	return 0;
}
Ejemplo n.º 10
0
int main( int argc, char *argv[] ){
	parse_node_t *meh;
	parse_node_t *move;

	FILE *fp;
	char *filename = NULL;
	char *output_name = "testout.s";
	char *backend = "default";
	char c;

	int	i = 0;

	enum arg_flags flags = ARG_FLAG_DUMP_NONE;

	if ( argc < 2 ){
		do_help( argv );
		return 0;
	}

	while (( c = getopt( argc, argv, "f:b:o:plh" )) != -1 && i++ < argc ){
		switch( c ){
			case 'f':
				filename = argv[++i];
				break;

			case 'b':
				backend = argv[++i];
				break;

			case 'h':
				do_help( argv );
				exit( 0 );
				break;

			case 'l':
				flags |= ARG_FLAG_DUMP_LEX;
				break;

			case 'p':
				flags |= ARG_FLAG_DUMP_PARSE;
				break;

			case 'o':
				output_name = argv[++i];
				break;
		}
	}

	if ( !filename ){
		do_help( argv );
		return 0;
	}

	fp = fopen( filename, "r" );
	move = meh = lex_file( fp );
	fclose( fp );

	if ( flags & ARG_FLAG_DUMP_LEX ){
		printf( "-=[ Lexer dump: \n" );
		dump_tree( 0, move );
	}

	move = parse_tokens( meh );

	if ( strcmp( backend, "default" ) == 0 || strcmp( backend, "nasm_x86_64" ) == 0 ){
		generate_output_asm( move, output_name, flags );

	} else {
		die( 1, "Unknown backend \"%s\"\n", backend );
	}

	return 0;
}
Ejemplo n.º 11
0
int main(int argc, char** argv)
{
	if (argc>1 && strstr(argv[1],"debug"))
		debug_mode=1;
	if (argc>1 && strstr(argv[1],"oneshot"))
		one_shot_mode=1;

	if (getenv("IRQBALANCE_BANNED_CPUS"))  {
		cpumask_parse_user(getenv("IRQBALANCE_BANNED_CPUS"), strlen(getenv("IRQBALANCE_BANNED_CPUS")), banned_cpus);
	}

	if (getenv("IRQBALANCE_ONESHOT")) 
		one_shot_mode=1;

	if (getenv("IRQBALANCE_DEBUG")) 
		debug_mode=1;

	parse_cpu_tree();


	/* On single core UP systems irqbalance obviously has no work to do */
	if (core_count<2) 
		exit(EXIT_SUCCESS);
	/* On dual core/hyperthreading shared cache systems just do a one shot setup */
	if (cache_domain_count==1)
		one_shot_mode = 1;

	if (!debug_mode)
		if (daemon(0,0))
			exit(EXIT_FAILURE);

#ifdef HAVE_LIBCAP_NG
	// Drop capabilities
	capng_clear(CAPNG_SELECT_BOTH);
	capng_lock();
	capng_apply(CAPNG_SELECT_BOTH);
#endif

	parse_proc_interrupts();
	sleep(SLEEP_INTERVAL/4);
	reset_counts();
	parse_proc_interrupts();
	pci_numa_scan();
	calculate_workload();
	sort_irq_list();
	if (debug_mode)
		dump_workloads();
	
	while (1) {
		sleep_approx(SLEEP_INTERVAL);
		if (debug_mode)
			printf("\n\n\n-----------------------------------------------------------------------------\n");


		check_power_mode();
		parse_proc_interrupts();

		/* cope with cpu hotplug -- detected during /proc/interrupts parsing */
		if (need_cpu_rescan) {
			need_cpu_rescan = 0;
			/* if there's a hotplug event we better turn off power mode for a bit until things settle */
			power_mode = 0;
			if (debug_mode)
				printf("Rescanning cpu topology \n");
			reset_counts();
			clear_work_stats();

			clear_cpu_tree();
			parse_cpu_tree();
		}

		/* deal with NAPI */
		account_for_nic_stats();
		calculate_workload();

		/* to cope with dynamic configurations we scan for new numa information
		 * once every 5 minutes
		 */
		if (counter % NUMA_REFRESH_INTERVAL == 16)
			pci_numa_scan();

		calculate_placement();
		activate_mapping();
	
		if (debug_mode)
			dump_tree();
		if (one_shot_mode)
			break;
		counter++;
	}
	return EXIT_SUCCESS;
}
Ejemplo n.º 12
0
Archivo: ptree.hpp Proyecto: go4and/lib
 void dump(std::ostream & out) const
 {
     dump_tree(out, *tree_);
 }