Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
#include <vector>

#include "commands.h"
#include "pm4_info.h"
#include "dive_core/dive_core_init.h"

using namespace Dive::cli; // NOLINT

int main(int argc, char** argv)
{
Dive::cli::Init();
Pm4InfoInit();
Dive::InitDiveCore();

std::map<std::string, const Command*> commands;
std::vector<const Command*> commandlist = {
Expand Down
2 changes: 2 additions & 0 deletions dive_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ add_library(
dive_capture_data.h
dive_command_hierarchy.cpp
dive_command_hierarchy.h
dive_core_init.cpp
dive_core_init.h
dive_strings.cpp
dive_strings.h
error.cpp
Expand Down
33 changes: 33 additions & 0 deletions dive_core/dive_core_init.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright 2026 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#include "dive_core/dive_core_init.h"

#include "pm4_info.h"

namespace Dive
{

void InitDiveCore()
{
static auto init_flag = []() {
Pm4InfoInit();
return 0;
}();
(void)init_flag;
}

} // namespace Dive
24 changes: 24 additions & 0 deletions dive_core/dive_core_init.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2026 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#pragma once

namespace Dive
{

void InitDiveCore();

}
4 changes: 2 additions & 2 deletions lrz_validator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <vector>

#include "dive_core/data_core.h"
#include "pm4_info.h"
#include "dive_core/dive_core_init.h"

bool ValidateLRZ(const Dive::CaptureMetadata& meta_data, const std::string& output_file_name)
{
Expand Down Expand Up @@ -143,7 +143,7 @@ bool ValidateLRZ(const Dive::CaptureMetadata& meta_data, const std::string& outp

int main(int argc, char** argv)
{
Pm4InfoInit();
Dive::InitDiveCore();

// Handle args
if ((argc != 2) && (argc != 3))
Expand Down
4 changes: 2 additions & 2 deletions trace_stats/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

#include "dive/types/context.h"
#include "dive_core/data_core.h"
#include "pm4_info.h"
#include "dive_core/dive_core_init.h"
#include "trace_stats.h"

int main(int argc, char** argv)
{
Pm4InfoInit();
Dive::InitDiveCore();

// Handle args
if ((argc != 2) && (argc != 3))
Expand Down
4 changes: 2 additions & 2 deletions ui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "custom_metatypes.h"
#include "dive/os/terminal.h"
#include "dive_core/common.h"
#include "dive_core/pm4_info.h"
#include "dive_core/dive_core_init.h"
#include "main_window.h"
#include "utils/version_info.h"
#ifdef __linux__
Expand Down Expand Up @@ -351,7 +351,7 @@ int main(int argc, char* argv[])
splash_screen->show();

// Initialize packet info query data structures needed for parsing
Pm4InfoInit();
Dive::InitDiveCore();

ApplicationController controller;
MainWindow* main_window = new MainWindow(controller);
Expand Down
Loading