Skip to content

Commit da5fcf0

Browse files
committed
Merge remote-tracking branch 'origin/main' into releases/v50.x
2 parents c0b8155 + 9611799 commit da5fcf0

File tree

20 files changed

+444
-392
lines changed

20 files changed

+444
-392
lines changed

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,6 +1682,7 @@ perfetto_filegroup(
16821682
"src/trace_processor/dataframe/impl/query_plan.cc",
16831683
"src/trace_processor/dataframe/impl/query_plan.h",
16841684
"src/trace_processor/dataframe/impl/slab.h",
1685+
"src/trace_processor/dataframe/impl/static_vector.h",
16851686
"src/trace_processor/dataframe/impl/types.h",
16861687
],
16871688
)

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Unreleased:
1111
*
1212

1313

14+
v50.1 - 2025-04-17:
15+
Trace Processor:
16+
* Fix build on windows
17+
18+
1419
v50.0 - 2025-04-17:
1520
Tracing service and probes:
1621
* Removed mm_events support as it is no longer maintained.

include/perfetto/ext/base/http/http_server.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ class HttpServer : public UnixSocket::EventListener {
160160
HttpServer(TaskRunner*, HttpRequestHandler*);
161161
~HttpServer() override;
162162
void Start(int port);
163-
void Start(const std::string& listen_ip, int port);
164163
void AddAllowedOrigin(const std::string&);
165164

166165
private:
@@ -169,9 +168,6 @@ class HttpServer : public UnixSocket::EventListener {
169168
void HandleCorsPreflightRequest(const HttpRequest&);
170169
bool IsOriginAllowed(StringView);
171170

172-
void ListenOnIpV4(const std::string& ip_addr);
173-
void ListenOnIpV6(const std::string& ip_addr);
174-
175171
// UnixSocket::EventListener implementation.
176172
void OnNewIncomingConnection(UnixSocket*,
177173
std::unique_ptr<UnixSocket>) override;

include/perfetto/ext/base/unix_socket.h

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ enum class SockPeerCredMode {
7474
#endif
7575
};
7676

77-
// Returns the socket family from the full address that perfetto uses.
77+
// Returns the socket family from the full addres that perfetto uses.
7878
// Addr can be:
7979
// - /path/to/socket : for linked AF_UNIX sockets.
8080
// - @abstract_name : for abstract AF_UNIX sockets.
@@ -83,25 +83,6 @@ enum class SockPeerCredMode {
8383
// - vsock://-1:3000 : for VM sockets.
8484
SockFamily GetSockFamily(const char* addr);
8585

86-
// NetAddrInfo is a wrapper for a full address and it's family
87-
// and type.
88-
struct NetAddrInfo {
89-
NetAddrInfo(const std::string& ip_port, SockFamily family, SockType type)
90-
: ip_port_(ip_port), family_(family), type_(type) {}
91-
std::string ip_port_; // full address with ip and port
92-
SockFamily family_; // socket family
93-
SockType type_; // socket type
94-
};
95-
96-
// Returns a list of NetAddrInfo from ip and port which
97-
// ip can be an ipv4 or an ipv6 or a domain.
98-
// 127.0.0.1 : ipv4 address
99-
// localhost : domain
100-
// ::1 : ipv6 address
101-
// port is a normal tcp port as string.
102-
std::vector<NetAddrInfo> GetNetAddrInfo(const std::string& ip,
103-
const std::string& port);
104-
10586
// Returns whether inter-process shared memory is supported for the socket.
10687
inline bool SockShmemSupported(SockFamily sock_family) {
10788
#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)

protos/third_party/chromium/chrome_track_event.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2386,7 +2386,7 @@ message InputTransferHandler {
23862386
// LINT.IfChange(TransferInputToVizResult)
23872387
enum TransferInputToVizResult {
23882388
// We don't expect this to be present in traces.
2389-
UNKNWON = 0;
2389+
UNKNOWN = 0;
23902390
SUCCESSFULLY_TRANSFERRED = 1;
23912391
INPUT_TRANSFER_HANDLER_NOT_FOUND_IN_MAP = 2;
23922392
NON_FINGER_TOOL_TYPE = 3;

src/base/http/http_server.cc

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -56,45 +56,23 @@ void HttpServer::Start(int port) {
5656
std::string ipv4_addr = "127.0.0.1:" + std::to_string(port);
5757
std::string ipv6_addr = "[::1]:" + std::to_string(port);
5858

59-
ListenOnIpV4(ipv4_addr);
60-
ListenOnIpV6(ipv6_addr);
61-
}
62-
63-
void HttpServer::ListenOnIpV4(const std::string& ip_addr) {
64-
sock4_ = UnixSocket::Listen(ip_addr, this, task_runner_, SockFamily::kInet,
59+
sock4_ = UnixSocket::Listen(ipv4_addr, this, task_runner_, SockFamily::kInet,
6560
SockType::kStream);
6661
bool ipv4_listening = sock4_ && sock4_->is_listening();
6762
if (!ipv4_listening) {
68-
PERFETTO_PLOG("Failed to listen on IPv4 socket: \"%s\"", ip_addr.c_str());
63+
PERFETTO_PLOG("Failed to listen on IPv4 socket: \"%s\"", ipv4_addr.c_str());
6964
sock4_.reset();
7065
}
71-
}
7266

73-
void HttpServer::ListenOnIpV6(const std::string& ip_addr) {
74-
sock6_ = UnixSocket::Listen(ip_addr, this, task_runner_, SockFamily::kInet6,
67+
sock6_ = UnixSocket::Listen(ipv6_addr, this, task_runner_, SockFamily::kInet6,
7568
SockType::kStream);
7669
bool ipv6_listening = sock6_ && sock6_->is_listening();
7770
if (!ipv6_listening) {
78-
PERFETTO_PLOG("Failed to listen on IPv6 socket: \"%s\"", ip_addr.c_str());
71+
PERFETTO_PLOG("Failed to listen on IPv6 socket: \"%s\"", ipv6_addr.c_str());
7972
sock6_.reset();
8073
}
8174
}
8275

83-
void HttpServer::Start(const std::string& listen_ip, int port) {
84-
std::string ip = listen_ip.empty() ? "localhost" : listen_ip;
85-
std::string port_str = std::to_string(port);
86-
std::vector<NetAddrInfo> addr_infos = GetNetAddrInfo(ip, port_str);
87-
for (NetAddrInfo& info : addr_infos) {
88-
if (info.family_ == SockFamily::kInet) {
89-
PERFETTO_ILOG("[HTTP] Starting HTTP server on %s", info.ip_port_.c_str());
90-
ListenOnIpV4(info.ip_port_);
91-
} else if (info.family_ == SockFamily::kInet6) {
92-
PERFETTO_ILOG("[HTTP] Starting HTTP server on %s", info.ip_port_.c_str());
93-
ListenOnIpV6(info.ip_port_);
94-
}
95-
}
96-
}
97-
9876
void HttpServer::AddAllowedOrigin(const std::string& origin) {
9977
allowed_origins_.emplace_back(origin);
10078
}

src/base/unix_socket.cc

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -257,43 +257,17 @@ SockaddrAny MakeSockAddr(SockFamily family, const std::string& socket_name) {
257257
PERFETTO_CHECK(false); // For GCC.
258258
}
259259

260-
void InitWinSockOnce() {
260+
ScopedSocketHandle CreateSocketHandle(SockFamily family, SockType type) {
261261
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
262262
static bool init_winsock_once = [] {
263263
WSADATA ignored{};
264264
return WSAStartup(MAKEWORD(2, 2), &ignored) == 0;
265265
}();
266266
PERFETTO_CHECK(init_winsock_once);
267267
#endif
268-
}
269-
270-
ScopedSocketHandle CreateSocketHandle(SockFamily family, SockType type) {
271-
InitWinSockOnce();
272268
return ScopedSocketHandle(socket(MkSockFamily(family), MkSockType(type), 0));
273269
}
274270

275-
std::string AddrinfoToIpStr(const struct addrinfo* addrinfo_ptr) {
276-
PERFETTO_CHECK(addrinfo_ptr && addrinfo_ptr->ai_addr);
277-
PERFETTO_CHECK((addrinfo_ptr->ai_family == AF_INET) ||
278-
(addrinfo_ptr->ai_family == AF_INET6));
279-
280-
void* addr_ptr = nullptr;
281-
char ip_str_buffer[INET6_ADDRSTRLEN];
282-
283-
if (addrinfo_ptr->ai_family == AF_INET) { // IPv4
284-
struct sockaddr_in* ipv4_addr =
285-
reinterpret_cast<struct sockaddr_in*>(addrinfo_ptr->ai_addr);
286-
addr_ptr = &(ipv4_addr->sin_addr);
287-
} else if (addrinfo_ptr->ai_family == AF_INET6) { // IPv6
288-
struct sockaddr_in6* ipv6_addr =
289-
reinterpret_cast<struct sockaddr_in6*>(addrinfo_ptr->ai_addr);
290-
addr_ptr = &(ipv6_addr->sin6_addr);
291-
}
292-
PERFETTO_CHECK(inet_ntop(addrinfo_ptr->ai_family, addr_ptr, ip_str_buffer,
293-
sizeof(ip_str_buffer)) != NULL);
294-
return std::string(ip_str_buffer);
295-
}
296-
297271
} // namespace
298272

299273
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
@@ -325,32 +299,6 @@ SockFamily GetSockFamily(const char* addr) {
325299
return SockFamily::kUnix; // For anything else assume it's a linked AF_UNIX.
326300
}
327301

328-
std::vector<NetAddrInfo> GetNetAddrInfo(const std::string& ip,
329-
const std::string& port) {
330-
InitWinSockOnce();
331-
struct addrinfo hints, *serv_info, *p;
332-
memset(&hints, 0, sizeof hints);
333-
hints.ai_family = AF_UNSPEC;
334-
hints.ai_socktype = SOCK_STREAM;
335-
hints.ai_flags = AI_PASSIVE;
336-
PERFETTO_CHECK(getaddrinfo(ip.c_str(), port.c_str(), &hints, &serv_info) ==
337-
0);
338-
std::vector<NetAddrInfo> res;
339-
for (p = serv_info; p != NULL; p = p->ai_next) {
340-
if (p->ai_family == AF_INET) {
341-
std::string ip_str = AddrinfoToIpStr(p);
342-
std::string ip_port = ip_str + ":" + port;
343-
res.emplace_back(ip_port, SockFamily::kInet, SockType::kStream);
344-
} else if (p->ai_family == AF_INET6) {
345-
std::string ip_str = AddrinfoToIpStr(p);
346-
std::string ip_port = "[" + ip_str + "]:" + port;
347-
res.emplace_back(ip_port, SockFamily::kInet6, SockType::kStream);
348-
}
349-
}
350-
freeaddrinfo(serv_info);
351-
return res;
352-
}
353-
354302
// +-----------------------+
355303
// | UnixSocketRaw methods |
356304
// +-----------------------+

src/trace_processor/dataframe/dataframe.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "src/trace_processor/containers/string_pool.h"
3030
#include "src/trace_processor/dataframe/cursor.h"
3131
#include "src/trace_processor/dataframe/impl/query_plan.h"
32+
#include "src/trace_processor/dataframe/impl/static_vector.h"
3233
#include "src/trace_processor/dataframe/impl/types.h"
3334
#include "src/trace_processor/dataframe/specs.h"
3435

@@ -139,9 +140,10 @@ class Dataframe {
139140
std::vector<ColumnSpec> CreateColumnSpecs() const {
140141
std::vector<ColumnSpec> specs;
141142
specs.reserve(columns_.size());
142-
for (const auto& col : columns_) {
143-
specs.push_back({col.name, col.storage.type(), col.overlay.nullability(),
144-
col.sort_state});
143+
for (uint32_t i = 0; i < columns_.size(); ++i) {
144+
const auto& col = columns_[i];
145+
specs.push_back({column_names_[i], col.storage.type(),
146+
col.null_storage.nullability(), col.sort_state});
145147
}
146148
return specs;
147149
}
@@ -153,15 +155,22 @@ class Dataframe {
153155
// dataframe.
154156
friend class DataframeBytecodeTest;
155157

156-
Dataframe(std::vector<impl::Column> columns,
158+
Dataframe(impl::FixedVector<std::string, impl::kMaxColumns> column_names,
159+
impl::FixedVector<impl::Column, impl::kMaxColumns> columns,
157160
uint32_t row_count,
158161
StringPool* string_pool)
159-
: columns_(std::move(columns)),
162+
: column_names_(std::move(column_names)),
163+
columns_(std::move(columns)),
160164
row_count_(row_count),
161165
string_pool_(string_pool) {}
162166

167+
// The names of all columns.
168+
// `column_names_` and `columns_` should always have the same size.
169+
impl::FixedVector<std::string, impl::kMaxColumns> column_names_;
170+
163171
// Internal storage for columns in the dataframe.
164-
std::vector<impl::Column> columns_;
172+
// `column_names_` and `columns_` should always have the same size.
173+
impl::FixedVector<impl::Column, impl::kMaxColumns> columns_;
165174

166175
// Number of rows in the dataframe.
167176
uint32_t row_count_ = 0;

0 commit comments

Comments
 (0)