• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

georgia-tech-db / eva / #758

04 Sep 2023 08:37PM UTC coverage: 0.0% (-78.3%) from 78.333%
#758

push

circle-ci

hershd23
Increased underline length in at line 75 in text_summarization.rst
	modified:   docs/source/benchmarks/text_summarization.rst

0 of 11303 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/evadb/utils/stats.py
1
# coding=utf-8
2
# Copyright 2018-2023 EvaDB
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15

16
import time
×
17
from dataclasses import dataclass
×
18

19
from evadb.utils.logging_manager import logger
×
20

21

22
class Timer:
×
23
    """Class used for logging time metrics.
24

25
    This is not thread safe"""
26

27
    def __init__(self):
×
28
        self._start_time = None
×
29
        self._total_time = 0.0
×
30

31
    def __enter__(self):
×
32
        assert self._start_time is None, "Concurrent calls are not supported"
×
33
        self._start_time = time.perf_counter()
×
34

35
    def __exit__(self, exc_type, exc_val, exc_tb):
×
36
        assert self._start_time is not None, "exit called with starting the context"
×
37
        time_elapsed = time.perf_counter() - self._start_time
×
38
        self._total_time += time_elapsed
×
39
        self._start_time = None
×
40

41
    @property
×
42
    def total_elapsed_time(self):
×
43
        return self._total_time
×
44

45
    def log_elapsed_time(self, context: str):
×
46
        logger.info("{:s}: {:0.4f} sec".format(context, self.total_elapsed_time))
×
47

48

49
@dataclass
×
50
class UDFStats:
×
51
    def __init__(self) -> None:
×
52
        self.num_calls: int = 0
×
53
        self.timer: Timer = Timer()
×
54
        self.prev_cost: float = 0.0
×
55
        self.cache_misses: int = 0
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc