Diff of /daemon/oprofiled.c [895e46] .. [29f0dd] Maximize Restore

  Switch to unified view

a/daemon/oprofiled.c b/daemon/oprofiled.c
...
...
5
 * @remark Copyright 2002, 2003 OProfile authors
5
 * @remark Copyright 2002, 2003 OProfile authors
6
 * @remark Read the file COPYING
6
 * @remark Read the file COPYING
7
 *
7
 *
8
 * @author John Levon
8
 * @author John Levon
9
 * @author Philippe Elie
9
 * @author Philippe Elie
10
 * Modified by Aravind Menon for Xen
11
 * These modifications are:
12
 * Copyright (C) 2005 Hewlett-Packard Co.
10
 */
13
 */
11
14
12
#include "config.h"
15
#include "config.h"
13
 
16
 
14
#include "oprofiled.h"
17
#include "oprofiled.h"
...
...
58
int separate_thread;
61
int separate_thread;
59
int separate_cpu;
62
int separate_cpu;
60
int no_vmlinux;
63
int no_vmlinux;
61
char * vmlinux;
64
char * vmlinux;
62
char * kernel_range;
65
char * kernel_range;
66
int no_xen;
67
char * xenimage;
68
char * xen_range;
63
static char * verbose;
69
static char * verbose;
64
static char * binary_name_filter;
70
static char * binary_name_filter;
65
static char * events;
71
static char * events;
66
static int showvers;
72
static int showvers;
67
static struct oprofiled_ops * opd_ops;
73
static struct oprofiled_ops * opd_ops;
...
...
73
79
74
static struct poptOption options[] = {
80
static struct poptOption options[] = {
75
    { "kernel-range", 'r', POPT_ARG_STRING, &kernel_range, 0, "Kernel VMA range", "start-end", },
81
    { "kernel-range", 'r', POPT_ARG_STRING, &kernel_range, 0, "Kernel VMA range", "start-end", },
76
    { "vmlinux", 'k', POPT_ARG_STRING, &vmlinux, 0, "vmlinux kernel image", "file", },
82
    { "vmlinux", 'k', POPT_ARG_STRING, &vmlinux, 0, "vmlinux kernel image", "file", },
77
    { "no-vmlinux", 0, POPT_ARG_NONE, &no_vmlinux, 0, "vmlinux kernel image file not available", NULL, },
83
    { "no-vmlinux", 0, POPT_ARG_NONE, &no_vmlinux, 0, "vmlinux kernel image file not available", NULL, },
84
  { "xen-range", 0, POPT_ARG_STRING, &xen_range, 0, "Xen VMA range", "start-end", },
85
  { "xen-image", 0, POPT_ARG_STRING, &xenimage, 0, "Xen image", "file", },
78
    { "image", 0, POPT_ARG_STRING, &binary_name_filter, 0, "image name filter", "profile these comma separated image" },
86
    { "image", 0, POPT_ARG_STRING, &binary_name_filter, 0, "image name filter", "profile these comma separated image" },
79
    { "separate-lib", 0, POPT_ARG_INT, &separate_lib, 0, "separate library samples for each distinct application", "[0|1]", },
87
    { "separate-lib", 0, POPT_ARG_INT, &separate_lib, 0, "separate library samples for each distinct application", "[0|1]", },
80
    { "separate-kernel", 0, POPT_ARG_INT, &separate_kernel, 0, "separate kernel samples for each distinct application", "[0|1]", },
88
    { "separate-kernel", 0, POPT_ARG_INT, &separate_kernel, 0, "separate kernel samples for each distinct application", "[0|1]", },
81
    { "separate-thread", 0, POPT_ARG_INT, &separate_thread, 0, "thread-profiling mode", "[0|1]" },
89
    { "separate-thread", 0, POPT_ARG_INT, &separate_thread, 0, "thread-profiling mode", "[0|1]" },
82
    { "separate-cpu", 0, POPT_ARG_INT, &separate_cpu, 0, "separate samples for each CPU", "[0|1]" },
90
    { "separate-cpu", 0, POPT_ARG_INT, &separate_cpu, 0, "separate samples for each CPU", "[0|1]" },
...
...
403
    if (events == NULL) {
411
    if (events == NULL) {
404
        fprintf(stderr, "oprofiled: no events specified.\n");
412
        fprintf(stderr, "oprofiled: no events specified.\n");
405
        poptPrintHelp(optcon, stderr, 0);
413
        poptPrintHelp(optcon, stderr, 0);
406
        exit(EXIT_FAILURE);
414
        exit(EXIT_FAILURE);
407
    }
415
    }
416
417
  if (!xenimage || !strcmp("", xenimage)) {
418
      no_xen = 1;
419
  } else {
420
      no_xen = 0;
421
422
      /* canonicalise xen image filename. */
423
      tmp = xmalloc(PATH_MAX);
424
      if (realpath(xenimage, tmp))
425
          xenimage = tmp;
426
      else
427
          free(tmp);
428
429
      if (!xen_range || !strcmp("", xen_range)) {
430
          fprintf(stderr, "oprofiled: no Xen VMA range specified.\n");
431
          poptPrintHelp(optcon, stderr, 0);
432
          exit(EXIT_FAILURE);
433
      }
408
    
434
    }
435
409
    opd_parse_events(events);
436
    opd_parse_events(events);
410
437
411
    opd_parse_image_filter();
438
    opd_parse_image_filter();
412
439
413
    poptFreeContext(optcon);
440
    poptFreeContext(optcon);