Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
047bd22a
R
rocksdb
项目概览
kvdb
/
rocksdb
11 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rocksdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
047bd22a
编写于
11月 20, 2015
作者:
Y
yuslepukhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Build on Visual Studio 2015 Update 1
上级
88e05277
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
17 deletion
+52
-17
CMakeLists.txt
CMakeLists.txt
+1
-0
db/db_test.cc
db/db_test.cc
+2
-2
port/win/port_win.cc
port/win/port_win.cc
+1
-1
port/win/port_win.h
port/win/port_win.h
+39
-7
util/thread_local_test.cc
util/thread_local_test.cc
+9
-7
未找到文件。
CMakeLists.txt
浏览文件 @
047bd22a
...
...
@@ -14,6 +14,7 @@
# 3. Run cmake to generate project files for Windows, add more options to enable required third-party libraries.
# See thirdparty.inc for more information.
# sample command: cmake -G "Visual Studio 12 Win64" -DGFLAGS=1 -DSNAPPY=1 -DJEMALLOC=1 ..
# OR for VS Studio 15 cmake -G "Visual Studio 12 Win64" -DGFLAGS=1 -DSNAPPY=1 -DJEMALLOC=1 ..
# 4. Then build the project in debug mode (you may want to add /m[:<N>] flag to run msbuild in <N> parallel threads
# or simply /m ot use all avail cores)
# msbuild rocksdb.sln
...
...
db/db_test.cc
浏览文件 @
047bd22a
...
...
@@ -8758,7 +8758,7 @@ TEST_F(DBTest, LargeBatchWithColumnFamilies) {
for
(
int
pass
=
1
;
pass
<=
3
;
pass
++
)
{
WriteBatch
batch
;
size_t
write_size
=
1024
*
1024
*
(
5
+
i
);
fprintf
(
stderr
,
"prepare: %
ld
MB, pass:%d
\n
"
,
(
write_size
/
1024
/
1024
),
fprintf
(
stderr
,
"prepare: %
"
ROCKSDB_PRIszt
"
MB, pass:%d
\n
"
,
(
write_size
/
1024
/
1024
),
pass
);
for
(;;)
{
std
::
string
data
(
3000
,
j
++
%
127
+
20
);
...
...
@@ -8768,7 +8768,7 @@ TEST_F(DBTest, LargeBatchWithColumnFamilies) {
break
;
}
}
fprintf
(
stderr
,
"write: %
ld
MB
\n
"
,
(
batch
.
GetDataSize
()
/
1024
/
1024
));
fprintf
(
stderr
,
"write: %
"
ROCKSDB_PRIszt
"
MB
\n
"
,
(
batch
.
GetDataSize
()
/
1024
/
1024
));
ASSERT_OK
(
dbfull
()
->
Write
(
WriteOptions
(),
&
batch
));
fprintf
(
stderr
,
"done
\n
"
);
}
...
...
port/win/port_win.cc
浏览文件 @
047bd22a
...
...
@@ -100,7 +100,7 @@ void CondVar::Signal() { cv_.notify_one(); }
void
CondVar
::
SignalAll
()
{
cv_
.
notify_all
();
}
void
InitOnce
(
OnceType
*
once
,
void
(
*
initializer
)())
{
std
::
call_once
(
*
once
,
initializer
);
std
::
call_once
(
once
->
flag_
,
initializer
);
}
// Private structure, exposed only by pointer
...
...
port/win/port_win.h
浏览文件 @
047bd22a
...
...
@@ -25,6 +25,7 @@
#include <string>
#include <string.h>
#include <mutex>
#include <limits>
#include <condition_variable>
#include <stdint.h>
...
...
@@ -58,8 +59,6 @@ typedef SSIZE_T ssize_t;
#define ROCKSDB_PRIszt "Iu"
#endif
#define ROCKSDB_NOEXCEPT
#define __attribute__(A)
#ifdef ZLIB
...
...
@@ -96,17 +95,35 @@ std::string GetWindowsErrSz(DWORD err);
namespace
port
{
// VS 15
#if (defined _MSC_VER) && (_MSC_VER >= 1900)
#define ROCKSDB_NOEXCEPT noexcept
// For use at db/file_indexer.h kLevelMaxIndex
const
int
kMaxInt32
=
INT32_MAX
;
const
uint64_t
kMaxUint64
=
UINT64_MAX
;
const
int
kMaxInt32
=
std
::
numeric_limits
<
int
>::
max
();
const
uint64_t
kMaxUint64
=
std
::
numeric_limits
<
uint64_t
>::
max
();
const
size_t
kMaxSizet
=
std
::
numeric_limits
<
size_t
>::
max
();
#else //_MSC_VER
#define ROCKSDB_NOEXCEPT
// std::numeric_limits<size_t>::max() is not constexpr just yet
// therefore, use the same limits
// For use at db/file_indexer.h kLevelMaxIndex
const
int
kMaxInt32
=
INT32_MAX
;
const
uint64_t
kMaxUint64
=
UINT64_MAX
;
#ifdef _WIN64
const
size_t
kMaxSizet
=
UINT64_MAX
;
#else
const
size_t
kMaxSizet
=
UINT_MAX
;
#endif
#endif //_MSC_VER
const
bool
kLittleEndian
=
true
;
class
CondVar
;
...
...
@@ -207,8 +224,23 @@ class CondVar {
Mutex
*
mu_
;
};
typedef
std
::
once_flag
OnceType
;
#define LEVELDB_ONCE_INIT std::once_flag::once_flag();
// OnceInit type helps emulate
// Posix semantics with initialization
// adopted in the project
struct
OnceType
{
struct
Init
{};
OnceType
()
{}
OnceType
(
const
Init
&
)
{}
OnceType
(
const
OnceType
&
)
=
delete
;
OnceType
&
operator
=
(
const
OnceType
&
)
=
delete
;
std
::
once_flag
flag_
;
};
#define LEVELDB_ONCE_INIT port::OnceType::Init()
extern
void
InitOnce
(
OnceType
*
once
,
void
(
*
initializer
)());
#define CACHE_LINE_SIZE 64U
...
...
@@ -280,4 +312,4 @@ using port::truncate;
}
// namespace rocksdb
#endif // STORAGE_LEVELDB_PORT_PORT_
POSIX
_H_
#endif // STORAGE_LEVELDB_PORT_PORT_
WIN
_H_
util/thread_local_test.cc
浏览文件 @
047bd22a
...
...
@@ -165,7 +165,9 @@ TEST_F(ThreadLocalTest, ConcurrentReadWriteTest) {
auto
&
p
=
*
static_cast
<
Params
*>
(
ptr
);
p
.
mu
->
Lock
();
int
own
=
++
(
p
.
started
);
// Size_T switches size along with the ptr size
// we want to cast to.
size_t
own
=
++
(
p
.
started
);
p
.
cv
->
SignalAll
();
while
(
p
.
started
!=
p
.
total
)
{
p
.
cv
->
Wait
();
...
...
@@ -183,16 +185,16 @@ TEST_F(ThreadLocalTest, ConcurrentReadWriteTest) {
auto
*
env
=
Env
::
Default
();
auto
start
=
env
->
NowMicros
();
p
.
tls1
.
Reset
(
reinterpret_cast
<
in
t
*>
(
own
));
p
.
tls2
->
Reset
(
reinterpret_cast
<
in
t
*>
(
own
+
1
));
p
.
tls1
.
Reset
(
reinterpret_cast
<
size_
t
*>
(
own
));
p
.
tls2
->
Reset
(
reinterpret_cast
<
size_
t
*>
(
own
+
1
));
// Loop for 1 second
while
(
env
->
NowMicros
()
-
start
<
1000
*
1000
)
{
for
(
int
iter
=
0
;
iter
<
100000
;
++
iter
)
{
ASSERT_TRUE
(
p
.
tls1
.
Get
()
==
reinterpret_cast
<
in
t
*>
(
own
));
ASSERT_TRUE
(
p
.
tls2
->
Get
()
==
reinterpret_cast
<
in
t
*>
(
own
+
1
));
ASSERT_TRUE
(
p
.
tls1
.
Get
()
==
reinterpret_cast
<
size_
t
*>
(
own
));
ASSERT_TRUE
(
p
.
tls2
->
Get
()
==
reinterpret_cast
<
size_
t
*>
(
own
+
1
));
if
(
p
.
doWrite
)
{
p
.
tls1
.
Reset
(
reinterpret_cast
<
in
t
*>
(
own
));
p
.
tls2
->
Reset
(
reinterpret_cast
<
in
t
*>
(
own
+
1
));
p
.
tls1
.
Reset
(
reinterpret_cast
<
size_
t
*>
(
own
));
p
.
tls2
->
Reset
(
reinterpret_cast
<
size_
t
*>
(
own
+
1
));
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录