• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ repsep_snprintf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中repsep_snprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ repsep_snprintf函数的具体用法?C++ repsep_snprintf怎么用?C++ repsep_snprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了repsep_snprintf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: hist_entry__srcline_snprintf

static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
				   size_t size, unsigned int width __used)
{
	FILE *fp;
	char cmd[PATH_MAX + 2], *path = self->srcline, *nl;
	size_t line_len;

	if (path != NULL)
		goto out_path;

	snprintf(cmd, sizeof(cmd), "addr2line -e %s %016" PRIx64,
		 self->ms.map->dso->long_name, self->ip);
	fp = popen(cmd, "r");
	if (!fp)
		goto out_ip;

	if (getline(&path, &line_len, fp) < 0 || !line_len)
		goto out_ip;
	fclose(fp);
	self->srcline = strdup(path);
	if (self->srcline == NULL)
		goto out_ip;

	nl = strchr(self->srcline, '\n');
	if (nl != NULL)
		*nl = '\0';
	path = self->srcline;
out_path:
	return repsep_snprintf(bf, size, "%s", path);
out_ip:
	return repsep_snprintf(bf, size, "%-#*llx", BITS_PER_LONG / 4, self->ip);
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:32,代码来源:sort.c


示例2: _hist_entry__sym_snprintf

static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
				     u64 ip, char level, char *bf, size_t size,
				     unsigned int width __used)
{
	size_t ret = 0;

	if (verbose) {
		char o = map ? dso__symtab_origin(map->dso) : '!';
		ret += repsep_snprintf(bf, size, "%-#*llx %c ",
				       BITS_PER_LONG / 4, ip, o);
	}

	ret += repsep_snprintf(bf + ret, size - ret, "[%c] ", level);
	if (sym)
		ret += repsep_snprintf(bf + ret, size - ret, "%-*s",
				       width - ret,
				       sym->name);
	else {
		size_t len = BITS_PER_LONG / 4;
		ret += repsep_snprintf(bf + ret, size - ret, "%-#.*llx",
				       len, ip);
		ret += repsep_snprintf(bf + ret, size - ret, "%-*s",
				       width - ret, "");
	}

	return ret;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:27,代码来源:sort.c


示例3: hist_entry__cycles_snprintf

static int hist_entry__cycles_snprintf(struct hist_entry *he, char *bf,
				    size_t size, unsigned int width)
{
	if (he->branch_info->flags.cycles == 0)
		return repsep_snprintf(bf, size, "%-*s", width, "-");
	return repsep_snprintf(bf, size, "%-*hd", width,
			       he->branch_info->flags.cycles);
}
开发者ID:Chong-Li,项目名称:cse522,代码行数:8,代码来源:sort.c


示例4: _hist_entry__dso_snprintf

static int _hist_entry__dso_snprintf(struct map *map, char *bf,
				     size_t size, unsigned int width)
{
	if (map && map->dso) {
		const char *dso_name = !verbose ? map->dso->short_name :
			map->dso->long_name;
		return repsep_snprintf(bf, size, "%-*s", width, dso_name);
	}

	return repsep_snprintf(bf, size, "%-*s", width, "[unknown]");
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:11,代码来源:sort.c


示例5: _hist_entry__sym_snprintf

static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
				     u64 ip, char level, char *bf, size_t size,
				     unsigned int width)
{
	size_t ret = 0;

	if (verbose) {
		char o = map ? dso__symtab_origin(map->dso) : '!';
		ret += repsep_snprintf(bf, size, "%-#*llx %c ",
				       BITS_PER_LONG / 4 + 2, ip, o);
	}

	ret += repsep_snprintf(bf + ret, size - ret, "[%c] ", level);
	if (sym && map) {
		if (map->type == MAP__VARIABLE) {
			ret += repsep_snprintf(bf + ret, size - ret, "%s", sym->name);
			ret += repsep_snprintf(bf + ret, size - ret, "+0x%llx",
					ip - map->unmap_ip(map, sym->start));
			ret += repsep_snprintf(bf + ret, size - ret, "%-*s",
				       width - ret, "");
		} else {
			ret += repsep_snprintf(bf + ret, size - ret, "%-*s",
					       width - ret,
					       sym->name);
		}
	} else {
		size_t len = BITS_PER_LONG / 4;
		ret += repsep_snprintf(bf + ret, size - ret, "%-#.*llx",
				       len, ip);
		ret += repsep_snprintf(bf + ret, size - ret, "%-*s",
				       width - ret, "");
	}

	return ret;
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:35,代码来源:sort.c


示例6: hist_entry__snoop_snprintf

static int hist_entry__snoop_snprintf(struct hist_entry *he, char *bf,
				    size_t size, unsigned int width)
{
	char out[64];
	size_t sz = sizeof(out) - 1; /* -1 for null termination */
	size_t i, l = 0;
	u64 m = PERF_MEM_SNOOP_NA;

	out[0] = '\0';

	if (he->mem_info)
		m = he->mem_info->data_src.mem_snoop;

	for (i = 0; m && i < NUM_SNOOP_ACCESS; i++, m >>= 1) {
		if (!(m & 0x1))
			continue;
		if (l) {
			strcat(out, " or ");
			l += 4;
		}
		strncat(out, snoop_access[i], sz - l);
		l += strlen(snoop_access[i]);
	}

	if (*out == '\0')
		strcpy(out, "N/A");

	return repsep_snprintf(bf, size, "%-*s", width, out);
}
开发者ID:3null,项目名称:linux,代码行数:29,代码来源:sort.c


示例7: hist_entry__abort_snprintf

static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf,
				    size_t size, unsigned int width)
{
	static const char *out = ".";

	if (he->branch_info->flags.abort)
		out = "A";
	return repsep_snprintf(bf, size, "%-*s", width, out);
}
开发者ID:3null,项目名称:linux,代码行数:9,代码来源:sort.c


示例8: hist_entry__dso_to_snprintf

static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf,
				       size_t size, unsigned int width)
{
	if (he->branch_info)
		return _hist_entry__dso_snprintf(he->branch_info->to.map,
						 bf, size, width);
	else
		return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
}
开发者ID:lovejavaee,项目名称:linux-2,代码行数:9,代码来源:sort.c


示例9: hist_entry__mispredict_snprintf

static int hist_entry__mispredict_snprintf(struct hist_entry *self, char *bf,
				    size_t size, unsigned int width){
	static const char *out = "N/A";

	if (self->branch_info->flags.predicted)
		out = "N";
	else if (self->branch_info->flags.mispred)
		out = "Y";

	return repsep_snprintf(bf, size, "%-*s", width, out);
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:11,代码来源:sort.c


示例10: hist_entry__sym_to_snprintf

static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf,
				       size_t size, unsigned int width)
{
	if (he->branch_info) {
		struct addr_map_symbol *to = &he->branch_info->to;

		return _hist_entry__sym_snprintf(to->map, to->sym, to->addr,
						 he->level, bf, size, width);
	}

	return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
}
开发者ID:lovejavaee,项目名称:linux-2,代码行数:12,代码来源:sort.c


示例11: hist_entry__lvl_snprintf

static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
				    size_t size, unsigned int width)
{
	char out[64];
	size_t sz = sizeof(out) - 1; /* -1 for null termination */
	size_t i, l = 0;
	u64 m =  PERF_MEM_LVL_NA;
	u64 hit, miss;
	int filter;

	if (he->mem_info)
		m  = he->mem_info->data_src.mem_lvl;

	out[0] = '\0';
	
	//PERF_MEM_LVL_HIT = 0x2 , PERF_MEM_LVL_MISS= 0x04
	hit = m & PERF_MEM_LVL_HIT;
	miss = m & PERF_MEM_LVL_MISS;

	/* already taken care of */
	//the result of the or operation is 0b110
	//negated 111..001 it means it will clear bit positions 1 and 2
	m &= ~(PERF_MEM_LVL_HIT|PERF_MEM_LVL_MISS);
	
	//see above function for definition of NUM_MEM_LVL
	for (i = 0; m && i < NUM_MEM_LVL; i++, m >>= 1) {
		//nothing happens it the ith bit is 0
		if (!(m & 0x1))
			continue;
		if (l) {
			strcat(out, " or ");
			l += 4;
		}
		//If the mask is not one it will add something to the output string
		strncat(out, mem_lvl[i], sz - l);
		l += strlen(mem_lvl[i]);
	}
	filter=filter_local_accesses(he);
	char filt[3];
	sprintf(filt," %d ",filter);
	
	if (*out == '\0')
		strcpy(out, "N/A");
	if (hit)
		strncat(out, " hit", sz - l);
	if (miss)
		strncat(out, " miss", sz - l);
		
		strncat(out, filt,3);

	return repsep_snprintf(bf, size, "%-*s", width, out);
}
开发者ID:daniel-ortiz,项目名称:perf-initial,代码行数:52,代码来源:sort.c


示例12: hist_entry__in_tx_snprintf

static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf,
				    size_t size, unsigned int width)
{
	static const char *out = "N/A";

	if (he->branch_info) {
		if (he->branch_info->flags.in_tx)
			out = "T";
		else
			out = ".";
	}

	return repsep_snprintf(bf, size, "%-*s", width, out);
}
开发者ID:lovejavaee,项目名称:linux-2,代码行数:14,代码来源:sort.c


示例13: hist_entry__locked_snprintf

static int hist_entry__locked_snprintf(struct hist_entry *he, char *bf,
				    size_t size, unsigned int width)
{
	const char *out;
	u64 mask = PERF_MEM_LOCK_NA;

	if (he->mem_info)
		mask = he->mem_info->data_src.mem_lock;

	if (mask & PERF_MEM_LOCK_NA)
		out = "N/A";
	else if (mask & PERF_MEM_LOCK_LOCKED)
		out = "Yes";
	else
		out = "No";

	return repsep_snprintf(bf, size, "%-*s", width, out);
}
开发者ID:3null,项目名称:linux,代码行数:18,代码来源:sort.c


示例14: hist_entry__lvl_snprintf

static int hist_entry__lvl_snprintf(struct hist_entry *he, char *bf,
				    size_t size, unsigned int width)
{
	char out[64];
	size_t sz = sizeof(out) - 1; /* -1 for null termination */
	size_t i, l = 0;
	u64 m =  PERF_MEM_LVL_NA;
	u64 hit, miss;

	if (he->mem_info)
		m  = he->mem_info->data_src.mem_lvl;

	out[0] = '\0';

	hit = m & PERF_MEM_LVL_HIT;
	miss = m & PERF_MEM_LVL_MISS;

	/* already taken care of */
	m &= ~(PERF_MEM_LVL_HIT|PERF_MEM_LVL_MISS);

	for (i = 0; m && i < NUM_MEM_LVL; i++, m >>= 1) {
		if (!(m & 0x1))
			continue;
		if (l) {
			strcat(out, " or ");
			l += 4;
		}
		strncat(out, mem_lvl[i], sz - l);
		l += strlen(mem_lvl[i]);
	}
	if (*out == '\0')
		strcpy(out, "N/A");
	if (hit)
		strncat(out, " hit", sz - l);
	if (miss)
		strncat(out, " miss", sz - l);

	return repsep_snprintf(bf, size, "%-*s", width, out);
}
开发者ID:3null,项目名称:linux,代码行数:39,代码来源:sort.c


示例15: hist_entry__cpu_snprintf

static int hist_entry__cpu_snprintf(struct hist_entry *self, char *bf,
				       size_t size, unsigned int width)
{
	return repsep_snprintf(bf, size, "%-*d", width, self->cpu);
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:5,代码来源:sort.c


示例16: hist_entry__srcline_snprintf

static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
					size_t size,
					unsigned int width __maybe_unused)
{
	return repsep_snprintf(bf, size, "%s", he->srcline);
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:6,代码来源:sort.c


示例17: hist_entry__parent_snprintf

static int hist_entry__parent_snprintf(struct hist_entry *self, char *bf,
				       size_t size, unsigned int width)
{
	return repsep_snprintf(bf, size, "%-*s", width,
			      self->parent ? self->parent->name : "[other]");
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:6,代码来源:sort.c


示例18: hist_entry__comm_snprintf

static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
				     size_t size, unsigned int width)
{
	return repsep_snprintf(bf, size, "%-*.*s", width, width, comm__str(he->comm));
}
开发者ID:3null,项目名称:linux,代码行数:5,代码来源:sort.c


示例19: hist_entry__srcline_snprintf

static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
					size_t size, unsigned int width)
{
	return repsep_snprintf(bf, size, "%*.*-s", width, width, he->srcline);
}
开发者ID:3null,项目名称:linux,代码行数:5,代码来源:sort.c


示例20: hist_entry__cpu_snprintf

static int hist_entry__cpu_snprintf(struct hist_entry *he, char *bf,
				    size_t size, unsigned int width)
{
	return repsep_snprintf(bf, size, "%*.*d", width, width, he->cpu);
}
开发者ID:3null,项目名称:linux,代码行数:5,代码来源:sort.c



注:本文中的repsep_snprintf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ req_capsule_server_get函数代码示例发布时间:2022-05-30
下一篇:
C++ reposition函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap