session.c (002c4fd92d772becf8745b9cbcebe5c95fe6dad0) | session.c (efad14150a0b4429f37da7245001a8096ef7ee38) |
---|---|
1#define _FILE_OFFSET_BITS 64 2 3#include <linux/kernel.h> 4 5#include <byteswap.h> 6#include <unistd.h> 7#include <sys/types.h> 8#include <sys/mman.h> --- 93 unchanged lines hidden (view full) --- 102 machine__destroy_kernel_maps(&self->host_machine); 103 machines__destroy_guest_kernel_maps(&self->machines); 104} 105 106struct perf_session *perf_session__new(const char *filename, int mode, 107 bool force, bool repipe, 108 struct perf_tool *tool) 109{ | 1#define _FILE_OFFSET_BITS 64 2 3#include <linux/kernel.h> 4 5#include <byteswap.h> 6#include <unistd.h> 7#include <sys/types.h> 8#include <sys/mman.h> --- 93 unchanged lines hidden (view full) --- 102 machine__destroy_kernel_maps(&self->host_machine); 103 machines__destroy_guest_kernel_maps(&self->machines); 104} 105 106struct perf_session *perf_session__new(const char *filename, int mode, 107 bool force, bool repipe, 108 struct perf_tool *tool) 109{ |
110 size_t len = filename ? strlen(filename) : 0; 111 struct perf_session *self = zalloc(sizeof(*self) + len); | 110 struct perf_session *self; 111 struct stat st; 112 size_t len; |
112 | 113 |
114 if (!filename || !strlen(filename)) { 115 if (!fstat(STDIN_FILENO, &st) && S_ISFIFO(st.st_mode)) 116 filename = "-"; 117 else 118 filename = "perf.data"; 119 } 120 121 len = strlen(filename); 122 self = zalloc(sizeof(*self) + len); 123 |
|
113 if (self == NULL) 114 goto out; 115 116 memcpy(self->filename, filename, len); 117 /* 118 * On 64bit we can mmap the data file in one go. No need for tiny mmap 119 * slices. On 32bit we use 32MB. 120 */ --- 1297 unchanged lines hidden --- | 124 if (self == NULL) 125 goto out; 126 127 memcpy(self->filename, filename, len); 128 /* 129 * On 64bit we can mmap the data file in one go. No need for tiny mmap 130 * slices. On 32bit we use 32MB. 131 */ --- 1297 unchanged lines hidden --- |