Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
jlib
Commits
8e5b2e1d
Commit
8e5b2e1d
authored
Apr 07, 2021
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
aec2ca96
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
19 deletions
+35
-19
observer.h
jlib/dp/observer.h
+2
-2
singleton.h
jlib/dp/singleton.h
+2
-2
log.h
jlib/log.h
+4
-5
diskdrive.cpp
jlib/win32/info/diskdrive.cpp
+11
-7
gpu.cpp
jlib/win32/info/gpu.cpp
+10
-1
logicaldrive.cpp
jlib/win32/info/logicaldrive.cpp
+6
-2
No files found.
jlib/dp/observer.h
View file @
8e5b2e1d
...
...
@@ -3,7 +3,7 @@
#include <memory>
#include <list>
#include <mutex>
#include
<boost/noncopyable.hpp>
#include
"../base/noncopyable.h"
namespace
jlib
{
namespace
dp
{
...
...
@@ -17,7 +17,7 @@ public:
template
<
typename
target
>
class
observable
:
public
boost
::
noncopyable
class
observable
:
public
noncopyable
{
public
:
typedef
observer
<
target
>
observer_type
;
...
...
jlib/dp/singleton.h
View file @
8e5b2e1d
#pragma once
#include <memory>
#include <mutex>
#include
<boost/noncopyable.hpp>
#include
"../base/noncopyable.h"
namespace
jlib
{
namespace
dp
{
template
<
class
T
>
class
singleton
:
public
boost
::
noncopyable
class
singleton
:
public
noncopyable
{
protected
:
static
std
::
shared_ptr
<
T
>
instance_
;
...
...
jlib/log.h
View file @
8e5b2e1d
...
...
@@ -18,9 +18,8 @@
#include <cstdint>
#include <cstdarg>
#include <algorithm>
#include <boost/noncopyable.hpp>
#include "utf8.h"
#include "chrono_wrapper.h"
#include "
util/
chrono_wrapper.h"
#include "dp/singleton.h"
namespace
jlib
...
...
@@ -171,7 +170,7 @@ public:
*
p
=
'\0'
;
#if defined(WIN32)
auto
msg
=
instance
->
format_msg
(
utf8
::
u
16_to_mbcs
(
buf
));
auto
msg
=
instance
->
format_msg
(
win32
::
utf
16_to_mbcs
(
buf
));
#else
auto
msg
=
instance
->
format_msg
(
utf8
::
w2a
(
buf
));
#endif
...
...
@@ -208,7 +207,7 @@ public:
}
std
::
string
format_msg
(
const
std
::
string
&
msg
)
{
return
line_prefix_
+
" "
+
now
_to_s
tring
(
true
)
+
" ---- "
+
msg
;
return
line_prefix_
+
" "
+
now
ToS
tring
(
true
)
+
" ---- "
+
msg
;
}
...
...
@@ -229,7 +228,7 @@ protected:
}
void
create_file_name
()
{
auto
s
=
now
_to_s
tring
();
auto
s
=
now
ToS
tring
();
std
::
replace
(
s
.
begin
(),
s
.
end
(),
' '
,
'_'
);
std
::
replace
(
s
.
begin
(),
s
.
end
(),
':'
,
'-'
);
log_file_path_
=
log_file_foler_
+
log_file_prefix_
+
"."
+
s
+
".log"
;
...
...
jlib/win32/info/diskdrive.cpp
View file @
8e5b2e1d
...
...
@@ -16,13 +16,17 @@ std::vector<DiskDrive> disk_drives()
if
(
wmi
::
WmiBase
::
simpleSelect
({
L"DeviceID"
,
L"Index"
,
L"Model"
,
L"Partitions"
,
L"SerialNumber"
,
L"Size"
,
},
L"Win32_DiskDrive"
,
L""
,
result
))
{
for
(
auto
&
item
:
result
)
{
DiskDrive
drive
;
drive
.
device_id
=
utf16_to_mbcs
(
item
[
L"DeviceID"
]);
drive
.
index
=
std
::
stoi
(
item
[
L"Index"
]);
drive
.
model
=
utf16_to_mbcs
(
item
[
L"Model"
]);
drive
.
partitions
=
std
::
stoi
(
item
[
L"Partitions"
]);
drive
.
serial
=
utf16_to_mbcs
(
item
[
L"SerialNumber"
]);
drive
.
size
=
std
::
stoull
(
item
[
L"Size"
]);
drives
.
push_back
(
drive
);
try
{
drive
.
index
=
std
::
stoi
(
item
[
L"Index"
]);
drive
.
partitions
=
std
::
stoi
(
item
[
L"Partitions"
]);
drive
.
size
=
std
::
stoull
(
item
[
L"Size"
]);
drive
.
device_id
=
utf16_to_mbcs
(
item
[
L"DeviceID"
]);
drive
.
model
=
utf16_to_mbcs
(
item
[
L"Model"
]);
drive
.
serial
=
utf16_to_mbcs
(
item
[
L"SerialNumber"
]);
drives
.
push_back
(
drive
);
}
catch
(...)
{
}
}
}
...
...
jlib/win32/info/gpu.cpp
View file @
8e5b2e1d
...
...
@@ -15,7 +15,16 @@ std::vector<Gpu> gpus()
for
(
auto
&&
item
:
result
)
{
Gpu
gpu
;
gpu
.
name
=
utf16_to_mbcs
(
item
[
L"Description"
]);
gpu
.
memsz
=
std
::
stoull
(
item
[
L"AdapterRAM"
]);
try
{
gpu
.
memsz
=
std
::
stoull
(
item
[
L"AdapterRAM"
]);
}
catch
(...)
{
try
{
gpu
.
name
=
utf16_to_mbcs
(
item
[
L"AdapterRAM"
]);
gpu
.
memsz
=
std
::
stoull
(
item
[
L"Description"
]);
}
catch
(...)
{
gpu
.
memsz
=
0
;
}
}
gs
.
push_back
(
gpu
);
}
}
...
...
jlib/win32/info/logicaldrive.cpp
View file @
8e5b2e1d
...
...
@@ -42,8 +42,12 @@ std::vector<LogicalDrive> logical_drives()
LogicalDrive
drive
;
drive
.
device_id
=
utf16_to_mbcs
(
item
[
L"DeviceID"
]);
drive
.
drive_type
=
parseDriveType
(
item
[
L"DriveType"
]);
drive
.
free_space
=
std
::
stoull
(
item
[
L"FreeSpace"
]);
drive
.
size
=
std
::
stoull
(
item
[
L"Size"
]);
try
{
drive
.
free_space
=
std
::
stoull
(
item
[
L"FreeSpace"
]);
drive
.
size
=
std
::
stoull
(
item
[
L"Size"
]);
}
catch
(...)
{
}
drive
.
volume_name
=
utf16_to_mbcs
(
item
[
L"VolumeName"
]);
drives
.
push_back
(
drive
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment