Coverage Report

Created: 2023-11-11 10:31

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Target/QueueList.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- QueueList.cpp -----------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "lldb/Target/Queue.h"
10
#include "lldb/Target/Process.h"
11
#include "lldb/Target/QueueList.h"
12
13
using namespace lldb;
14
using namespace lldb_private;
15
16
QueueList::QueueList(Process *process)
17
2.69k
    : m_process(process), m_stop_id(0), m_queues(), m_mutex() {}
18
19
2.59k
QueueList::~QueueList() { Clear(); }
20
21
80
uint32_t QueueList::GetSize() {
22
80
  std::lock_guard<std::mutex> guard(m_mutex);
23
80
  return m_queues.size();
24
80
}
25
26
40
lldb::QueueSP QueueList::GetQueueAtIndex(uint32_t idx) {
27
40
  std::lock_guard<std::mutex> guard(m_mutex);
28
40
  if (idx < m_queues.size()) {
29
40
    return m_queues[idx];
30
40
  } else {
31
0
    return QueueSP();
32
0
  }
33
40
}
34
35
17.7k
void QueueList::Clear() {
36
17.7k
  std::lock_guard<std::mutex> guard(m_mutex);
37
17.7k
  m_queues.clear();
38
17.7k
}
39
40
40
void QueueList::AddQueue(QueueSP queue_sp) {
41
40
  std::lock_guard<std::mutex> guard(m_mutex);
42
40
  if (queue_sp.get()) {
43
40
    m_queues.push_back(queue_sp);
44
40
  }
45
40
}
46
47
84
lldb::QueueSP QueueList::FindQueueByID(lldb::queue_id_t qid) {
48
84
  QueueSP ret;
49
504
  for (QueueSP queue_sp : Queues()) {
50
504
    if (queue_sp->GetID() == qid) {
51
44
      ret = queue_sp;
52
44
      break;
53
44
    }
54
504
  }
55
84
  return ret;
56
84
}
57
58
0
lldb::QueueSP QueueList::FindQueueByIndexID(uint32_t index_id) {
59
0
  QueueSP ret;
60
0
  for (QueueSP queue_sp : Queues()) {
61
0
    if (queue_sp->GetIndexID() == index_id) {
62
0
      ret = queue_sp;
63
0
      break;
64
0
    }
65
0
  }
66
0
  return ret;
67
0
}
68
69
0
std::mutex &QueueList::GetMutex() { return m_mutex; }