Пример #1
0
void
erts_deep_process_dump(fmtfn_t to, void *to_arg)
{
    int i, max = erts_ptab_max(&erts_proc);

    all_binaries = NULL;
    init_literal_areas();
    erts_init_persistent_dumping();

    for (i = 0; i < max; i++) {
	Process *p = erts_pix2proc(i);
	if (p && p->i != ENULL) {
	    erts_aint32_t state = erts_atomic32_read_acqb(&p->state);
	    if (state & ERTS_PSFLG_EXITING)
                continue;
            if (state & ERTS_PSFLG_GC) {
                ErtsSchedulerData *sdp = erts_get_scheduler_data();
                if (!sdp || p != sdp->current_process)
                    continue;

                /* We want to dump the garbing process that caused the dump */
            }

            dump_process_info(to, to_arg, p);
       }
    }

    dump_persistent_terms(to, to_arg);
    dump_literals(to, to_arg);
    dump_binaries(to, to_arg, all_binaries);
}
Пример #2
0
// Dump an object
void dump_object(sqlite3* db, long long oid)
{
	printf("dump object id=%lld\n", oid);
	dump_booleans(db, oid);
	dump_integers(db, oid);
	dump_binaries(db, oid);
	dump_arrays(db, oid);
}
Пример #3
0
void
erts_deep_process_dump(int to, void *to_arg)
{
    int i, max = erts_ptab_max(&erts_proc);

    all_binaries = NULL;
    
    for (i = 0; i < max; i++) {
	Process *p = erts_pix2proc(i);
	if (p && p->i != ENULL) {
	    erts_aint32_t state = erts_smp_atomic32_read_acqb(&p->state);
	    if (!(state & (ERTS_PSFLG_EXITING|ERTS_PSFLG_GC)))
		dump_process_info(to, to_arg, p);
       }
    }

    dump_binaries(to, to_arg, all_binaries);
}
Пример #4
0
void
erts_deep_process_dump(int to, void *to_arg)
{
    int i;

    all_binaries = NULL;
    
    for (i = 0; i < erts_max_processes; i++) {
	if ((process_tab[i] != NULL) && (process_tab[i]->i != ENULL)) {
	   if (process_tab[i]->status != P_EXITING) {
	       Process* p = process_tab[i];

	       if (p->status != P_GARBING) {
		   dump_process_info(to, to_arg, p);
	       }
	   }
       }
    }

    dump_binaries(to, to_arg, all_binaries);
}
Пример #5
0
int main(int argc, char **argv) {
  cl_platform_id platform;
  cl_device_id device;
  cl_context ctx;
  cl_program prog;
  cl_int errcode;
  FILE *bin;
  char *opencl_code_ptr;
  size_t opencl_code_len;
  char *flags = "";

  if (argc <= 1) {
    puts("usage: clcc input [flags] [output]");
    return 1;
  }

  if (clGetPlatformIDs(1, &platform, NULL) != CL_SUCCESS)
    return 1;

  if (clGetDeviceIDs(platform, CL_DEVICE_TYPE_DEFAULT, 1, &device, NULL) != CL_SUCCESS)
    return 2;

  ctx = clCreateContext(NULL, 1, &device, NULL, NULL, &errcode);
  if (!ctx)
    return 3;

  bin = fopen(argv[1], "r");
  if (!bin)
    return 4;

  fseek(bin, 0, SEEK_END);
  opencl_code_len = (size_t) ftell(bin);
  fseek(bin, 0, SEEK_SET);

  opencl_code_ptr = malloc(opencl_code_len);
  fread(opencl_code_ptr, opencl_code_len, 1, bin);
  fclose(bin);

  prog = clCreateProgramWithSource(ctx, 1, &opencl_code_ptr, &opencl_code_len, &errcode);
  if (!prog)
    return 5;

  free(opencl_code_ptr);

  if (argc > 2)
    flags = argv[2];

  if (clBuildProgram(prog, 1, &device, flags, NULL, NULL) != CL_SUCCESS) {
    size_t log_size;
    char *log;
    if (clGetProgramBuildInfo(prog, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size) != CL_SUCCESS)
      return 6;
    log = malloc(log_size);
    if (clGetProgramBuildInfo(prog, device, CL_PROGRAM_BUILD_LOG, log_size, log, NULL) != CL_SUCCESS)
      return 7;
    puts(log);
    return 8;
  }

  if (argc > 3) {
    if (dump_binaries(prog, argv[3]) != CL_SUCCESS)
      return 9;
  }

  return 0;
}