Lines Matching refs:size

48         if (index >= EXT_FEATURE_NAMES.size()) {
53 if (index >= FEATURE_NAMES.size()) {
90 if (Write((uint32_t)str.size() + 1)) { // include the ending \0
91 return Write(str.c_str(), str.size(), str.size() + 1);
97 bool PerfFileSection::Write(const char *buf, size_t size)
99 return Write(buf, size, size);
102 bool PerfFileSection::Write(const char *buf, size_t size, size_t max)
104 CHECK_TRUE(offset_ + size > maxSize_, false, 1,
105 "write out of size!!! offset_ %zu size %zu max %zu", offset_, size, maxSize_);
107 "write out of size!!! offset_ %zu size %zu max %zu", offset_, size, maxSize_);
109 std::copy(buf, buf + size, wBuffer_ + offset_);
110 if (size >= max) {
111 offset_ += size;
133 uint32_t size = 0;
134 CHECK_TRUE(!Read(size), false, 0, "");
135 // if size large than buf size or 0 size ?
137 CHECK_TRUE(size == 0 or size > maxSize_, false, 0, "");
138 char buf[size];
139 CHECK_TRUE(!Read(buf, size), false, 0, "");
140 CHECK_TRUE(buf[size - 1] != 0, false, 0, "");
142 HLOGDUMMY("Read String size %u buf : %s", size, value.c_str());
145 void PerfFileSection::Skip(size_t size)
147 offset_ += size;
150 bool PerfFileSection::Read(char *buf, size_t size)
153 if (size == 0) {
154 HLOGE("read zero size!!! offset_ %zu size %zu max %zu", offset_, size, maxSize_);
156 } else if (offset_ + size > maxSize_) {
157 HLOGE("read out of size!!! offset_ %zu size %zu max %zu", offset_, size, maxSize_);
158 if (memset_s(buf, size, 0, size) != EOK) { // make sure the content return is 0 when failed
164 HLOGD("PerfFileSection::Read offset_ %zu size %zu maxSize_ %zu", offset_, size, maxSize_);
165 std::copy((rBuffer_ + offset_), (rBuffer_ + offset_ + size), buf);
166 offset_ += size;
167 HLOGDUMMY("after read offset_ %zx size %zu buf %x", offset_, size, buf[0]);
173 return sizeof(uint32_t) + string.size() + 1; /* '\0' */
176 PerfFileSectionString::PerfFileSectionString(FEATURE id, const char *buf, size_t size)
179 Init(buf, size);
189 bool PerfFileSectionString::GetBinary(char *buf, size_t size)
191 CHECK_TRUE(size < GetSize(), false, 0, "");
193 Init(buf, size);
210 size_t size = 0;
212 size += sizeof(uint32_t); // how many SymbolFileStruct
214 size += SizeOf(symbolFileStruct.filePath_);
215 size += sizeof(symbolFileStruct.symbolType_);
216 size += sizeof(symbolFileStruct.textExecVaddr_);
217 size += sizeof(symbolFileStruct.textExecVaddrFileOffset_);
218 size += SizeOf(symbolFileStruct.buildId_);
220 size += sizeof(uint32_t); // how many SymbolStruct
222 size += sizeof(symbolStruct.vaddr_);
223 size += sizeof(symbolStruct.len_);
224 size += SizeOf(symbolStruct.symbolName_);
227 return size;
274 HLOGV(" %zu SymbolStruct read.", symbolFileStruct.symbolStructs_.size());
278 PerfFileSectionSymbolsFiles::PerfFileSectionSymbolsFiles(FEATURE id, const char *buf, size_t size)
281 Init(buf, size);
283 HLOGV(" %zu SymbolFileStruct read.", symbolFileStructs_.size());
286 bool PerfFileSectionSymbolsFiles::GetBinary(char *buf, size_t size)
288 HLOGV("PerfFileSectionSymbolsFiles get buffer size %zu.", size);
289 HLOG_ASSERT(size >= GetSize());
291 Init(buf, size);
292 CHECK_TRUE(!Write((uint32_t)symbolFileStructs_.size()), false, 1,
293 "PerfFileSectionSymbolsFiles write failed with %zu.", symbolFileStructs_.size());
301 Write((uint32_t)symbolFileStruct.symbolStructs_.size());
308 symbolFileStruct.symbolStructs_.size(), symbolFileStruct.filePath_.c_str(),
312 HLOGV("%zu SymbolFileStruct writed.", symbolFileStructs_.size());
317 PerfFileSectionUniStackTable::PerfFileSectionUniStackTable(FEATURE id, const char *buf, size_t size)
321 Init(buf, size);
344 bool PerfFileSectionUniStackTable::GetBinary(char *buf, size_t size)
346 HLOG_ASSERT(size >= GetSize());
347 Init(buf, size);
348 Write(uint32_t(processStackTable_->size()));
357 Write(uint32_t(idxs.size()));
375 size_t size = 0;
376 // section header info size
377 size += sizeof(uint32_t); // how many tables/process
379 size += it->second->GetWriteSize();
381 return size;
384 PerfFileSectionNrCpus::PerfFileSectionNrCpus(FEATURE id, const char *buf, size_t size)
387 Init(buf, size);
397 bool PerfFileSectionNrCpus::GetBinary(char *buf, size_t size)
399 CHECK_TRUE(size < GetSize(), false, 0, "");
401 Init(buf, size);
418 PerfFileSectionU64::PerfFileSectionU64(FEATURE id, const char *buf, size_t size)
421 Init(buf, size);
430 bool PerfFileSectionU64::GetBinary(char *buf, size_t size)
432 CHECK_TRUE(size < GetSize(), false, 0, "");
434 Init(buf, size);
456 PerfFileSectionEventDesc::PerfFileSectionEventDesc(FEATURE id, const char *buf, size_t size)
460 Init(buf, size);
478 HLOGW("skip %zu byte for diff attr size", attrSize - sizeof(perf_event_attr));
498 HLOGV("read complete. %zu events", eventDesces_.size());
501 bool PerfFileSectionEventDesc::GetBinary(char *buf, size_t size)
503 CHECK_TRUE(size < GetSize(), false, 0, "");
504 Init(buf, size);
506 CHECK_TRUE(!Write(static_cast<uint32_t>(eventDesces_.size())), false, 0, "");
510 CHECK_TRUE(!Write(static_cast<uint32_t>(eventDesc.ids.size())), false, 0, "");
513 CHECK_TRUE(!Write(reinterpret_cast<char*>(eventDesc.ids.data()), sizeof(uint64_t) * eventDesc.ids.size()),
521 size_t size = sizeof(uint32_t); // nr
522 size += sizeof(uint32_t); // attr_size
524 size += (eventDesces_.size() * sizeof(perf_event_attr));
525 size += (eventDesces_.size() * sizeof(uint32_t)); // nr_ids
527 size += SizeOf(eventDesc.name);
528 size += (sizeof(uint64_t) * eventDesc.ids.size());
530 return size;