souffle  2.0.2-371-g6315b36
DataComparator.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2016, The Souffle Developers. All rights reserved
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 #pragma once
10 
12 #include "souffle/profile/Row.h"
13 
14 #include <cmath>
15 #include <memory>
16 #include <vector>
17 
18 namespace souffle {
19 namespace profile {
20 
21 /*
22  * Data comparison functions for sorting tables
23  *
24  * Will sort the values of only one column, in descending order
25  *
26  */
28 public:
29  /** Sort by total time. */
30  static bool TIME(const std::shared_ptr<Row>& a, const std::shared_ptr<Row>& b) {
31  return a->cells[0]->getDoubleVal() > b->cells[0]->getDoubleVal();
32  }
33 
34  /** Sort by non-recursive time. */
35  static bool NR_T(const std::shared_ptr<Row>& a, const std::shared_ptr<Row>& b) {
36  return a->cells[1]->getDoubleVal() > b->cells[1]->getDoubleVal();
37  }
38 
39  /** Sort by recursive time. */
40  static bool R_T(const std::shared_ptr<Row>& a, const std::shared_ptr<Row>& b) {
41  return a->cells[2]->getDoubleVal() > b->cells[2]->getDoubleVal();
42  }
43 
44  /** Sort by copy time. */
45  static bool C_T(const std::shared_ptr<Row>& a, const std::shared_ptr<Row>& b) {
46  return a->cells[3]->getDoubleVal() > b->cells[3]->getDoubleVal();
47  }
48 
49  /** Sort by tuple count. */
50  static bool TUP(const std::shared_ptr<Row>& a, const std::shared_ptr<Row>& b) {
51  return b->cells[4]->getLongVal() < a->cells[4]->getLongVal();
52  }
53 
54  /** Sort by name. */
55  static bool NAME(const std::shared_ptr<Row>& a, const std::shared_ptr<Row>& b) {
56  return b->cells[5]->getStringVal() > a->cells[5]->getStringVal();
57  }
58 
59  /** Sort by ID. */
60  static bool ID(const std::shared_ptr<Row>& a, const std::shared_ptr<Row>& b) {
61  return b->cells[6]->getStringVal() > a->cells[6]->getStringVal();
62  }
63 };
64 
65 } // namespace profile
66 } // namespace souffle
CellInterface.h
souffle::profile::DataComparator::TIME
static bool TIME(const std::shared_ptr< Row > &a, const std::shared_ptr< Row > &b)
Sort by total time.
Definition: DataComparator.h:30
souffle::profile::DataComparator::R_T
static bool R_T(const std::shared_ptr< Row > &a, const std::shared_ptr< Row > &b)
Sort by recursive time.
Definition: DataComparator.h:40
souffle::profile::DataComparator::NR_T
static bool NR_T(const std::shared_ptr< Row > &a, const std::shared_ptr< Row > &b)
Sort by non-recursive time.
Definition: DataComparator.h:35
souffle::profile::DataComparator::ID
static bool ID(const std::shared_ptr< Row > &a, const std::shared_ptr< Row > &b)
Sort by ID.
Definition: DataComparator.h:60
souffle::profile::DataComparator::C_T
static bool C_T(const std::shared_ptr< Row > &a, const std::shared_ptr< Row > &b)
Sort by copy time.
Definition: DataComparator.h:45
souffle::profile::DataComparator
Definition: DataComparator.h:27
b
l j a showGridBackground &&c b raw series this eventEmitter b
Definition: htmlJsChartistMin.h:15
souffle
Definition: AggregateOp.h:25
Row.h
souffle::profile::DataComparator::NAME
static bool NAME(const std::shared_ptr< Row > &a, const std::shared_ptr< Row > &b)
Sort by name.
Definition: DataComparator.h:55
souffle::profile::DataComparator::TUP
static bool TUP(const std::shared_ptr< Row > &a, const std::shared_ptr< Row > &b)
Sort by tuple count.
Definition: DataComparator.h:50