expr.c (e80b500370e71b8cd7dd64be4080cee0a3e5068f) | expr.c (4a4a9bf9075fbc753ab20f05347fd1482d4801e4) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include <stdbool.h> 3#include <assert.h> 4#include <errno.h> 5#include <stdlib.h> 6#include <string.h> 7#include "metricgroup.h" 8#include "cpumap.h" 9#include "cputopo.h" 10#include "debug.h" | 1// SPDX-License-Identifier: GPL-2.0 2#include <stdbool.h> 3#include <assert.h> 4#include <errno.h> 5#include <stdlib.h> 6#include <string.h> 7#include "metricgroup.h" 8#include "cpumap.h" 9#include "cputopo.h" 10#include "debug.h" |
11#include "evlist.h" |
|
11#include "expr.h" 12#include "expr-bison.h" 13#include "expr-flex.h" 14#include "util/hashmap.h" 15#include "smt.h" 16#include "tsc.h" 17#include <api/fs/fs.h> 18#include <linux/err.h> --- 450 unchanged lines hidden (view full) --- 469 goto out; 470 } 471 472 pr_err("Unrecognized literal '%s'", literal); 473out: 474 pr_debug2("literal: %s = %f\n", literal, result); 475 return result; 476} | 12#include "expr.h" 13#include "expr-bison.h" 14#include "expr-flex.h" 15#include "util/hashmap.h" 16#include "smt.h" 17#include "tsc.h" 18#include <api/fs/fs.h> 19#include <linux/err.h> --- 450 unchanged lines hidden (view full) --- 470 goto out; 471 } 472 473 pr_err("Unrecognized literal '%s'", literal); 474out: 475 pr_debug2("literal: %s = %f\n", literal, result); 476 return result; 477} |
478 479/* Does the event 'id' parse? Determine via ctx->ids if possible. */ 480double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const char *id) 481{ 482 struct evlist *tmp; 483 double ret; 484 485 if (hashmap__find(ctx->ids, id, /*value=*/NULL)) 486 return 1.0; 487 488 if (!compute_ids) 489 return 0.0; 490 491 tmp = evlist__new(); 492 if (!tmp) 493 return NAN; 494 ret = parse_event(tmp, id) ? 0 : 1; 495 evlist__delete(tmp); 496 return ret; 497} |
|