mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting * Reformat all imports
This commit is contained in:
parent
413da4ca69
commit
aad2dccc9c
802 changed files with 6861 additions and 6395 deletions
|
@ -4,18 +4,21 @@
|
|||
|
||||
//! Memory profiling functions.
|
||||
|
||||
use crate::time::duration_from_seconds;
|
||||
use ipc_channel::ipc::{self, IpcReceiver};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use profile_traits::mem::ReportsChan;
|
||||
use profile_traits::mem::{ProfilerChan, ProfilerMsg, ReportKind, Reporter, ReporterRequest};
|
||||
use profile_traits::path;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use std::thread;
|
||||
use std::time::Instant;
|
||||
|
||||
use ipc_channel::ipc::{self, IpcReceiver};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use profile_traits::mem::{
|
||||
ProfilerChan, ProfilerMsg, ReportKind, Reporter, ReporterRequest, ReportsChan,
|
||||
};
|
||||
use profile_traits::path;
|
||||
|
||||
use crate::time::duration_from_seconds;
|
||||
|
||||
pub struct Profiler {
|
||||
/// The port through which messages are received.
|
||||
pub port: IpcReceiver<ProfilerMsg>,
|
||||
|
@ -384,22 +387,24 @@ impl ReportsForest {
|
|||
//---------------------------------------------------------------------------
|
||||
|
||||
mod system_reporter {
|
||||
use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR};
|
||||
#[cfg(target_os = "linux")]
|
||||
use libc::c_int;
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use libc::{c_void, size_t};
|
||||
use profile_traits::mem::{Report, ReportKind, ReporterRequest};
|
||||
use profile_traits::path;
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use std::ffi::CString;
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use std::mem::size_of;
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use std::ptr::null_mut;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
use libc::c_int;
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use libc::{c_void, size_t};
|
||||
use profile_traits::mem::{Report, ReportKind, ReporterRequest};
|
||||
use profile_traits::path;
|
||||
#[cfg(target_os = "macos")]
|
||||
use task_info::task_basic_info::{resident_size, virtual_size};
|
||||
|
||||
use super::{JEMALLOC_HEAP_ALLOCATED_STR, SYSTEM_HEAP_ALLOCATED_STR};
|
||||
|
||||
/// Collects global measurements from the OS and heap allocators.
|
||||
pub fn collect_reports(request: ReporterRequest) {
|
||||
let mut reports = vec![];
|
||||
|
@ -599,12 +604,13 @@ mod system_reporter {
|
|||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn resident_segments() -> Vec<(String, usize)> {
|
||||
use regex::Regex;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader};
|
||||
|
||||
use regex::Regex;
|
||||
|
||||
// The first line of an entry in /proc/<pid>/smaps looks just like an entry
|
||||
// in /proc/<pid>/maps:
|
||||
//
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
|
||||
//! Timing functions.
|
||||
|
||||
use crate::trace_dump::TraceDump;
|
||||
use ipc_channel::ipc::{self, IpcReceiver};
|
||||
use profile_traits::time::{
|
||||
ProfilerCategory, ProfilerChan, ProfilerData, ProfilerMsg, TimerMetadata,
|
||||
};
|
||||
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
|
||||
use servo_config::opts::OutputOptions;
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::fs::File;
|
||||
|
@ -19,6 +12,15 @@ use std::path::Path;
|
|||
use std::time::Duration;
|
||||
use std::{f64, thread, u32, u64};
|
||||
|
||||
use ipc_channel::ipc::{self, IpcReceiver};
|
||||
use profile_traits::time::{
|
||||
ProfilerCategory, ProfilerChan, ProfilerData, ProfilerMsg, TimerMetadata,
|
||||
TimerMetadataFrameType, TimerMetadataReflowType,
|
||||
};
|
||||
use servo_config::opts::OutputOptions;
|
||||
|
||||
use crate::trace_dump::TraceDump;
|
||||
|
||||
pub trait Formattable {
|
||||
fn format(&self, output: &Option<OutputOptions>) -> String;
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
//! A module for writing time profiler traces out to a self contained HTML file.
|
||||
|
||||
use std::io::{self, Write};
|
||||
use std::{fs, path};
|
||||
|
||||
use profile_traits::time::{ProfilerCategory, TimerMetadata};
|
||||
use serde::Serialize;
|
||||
use std::fs;
|
||||
use std::io::{self, Write};
|
||||
use std::path;
|
||||
|
||||
/// An RAII class for writing the HTML trace dump.
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue