Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
59397f3c
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
59397f3c
编写于
2月 16, 2011
作者:
D
dholmes
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
7eb9e924
a3b118c3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
59 addition
and
16 deletion
+59
-16
src/os/windows/vm/perfMemory_windows.cpp
src/os/windows/vm/perfMemory_windows.cpp
+59
-16
未找到文件。
src/os/windows/vm/perfMemory_windows.cpp
浏览文件 @
59397f3c
/*
* Copyright (c) 2001, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
1
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -298,8 +298,8 @@ static char* get_user_name() {
static
char
*
get_user_name_slow
(
int
vmid
)
{
// directory search
char
*
old
est_user
=
NULL
;
time_t
old
est_ctime
=
0
;
char
*
lat
est_user
=
NULL
;
time_t
lat
est_ctime
=
0
;
const
char
*
tmpdirname
=
os
::
get_temp_directory
();
...
...
@@ -375,18 +375,29 @@ static char* get_user_name_slow(int vmid) {
continue
;
}
// compare and save filename with latest creation time
if
(
statbuf
.
st_size
>
0
&&
statbuf
.
st_ctime
>
oldest_ctime
)
{
if
(
statbuf
.
st_ctime
>
oldest_ctime
)
{
char
*
user
=
strchr
(
dentry
->
d_name
,
'_'
)
+
1
;
if
(
oldest_user
!=
NULL
)
FREE_C_HEAP_ARRAY
(
char
,
oldest_user
);
oldest_user
=
NEW_C_HEAP_ARRAY
(
char
,
strlen
(
user
)
+
1
);
strcpy
(
oldest_user
,
user
);
oldest_ctime
=
statbuf
.
st_ctime
;
}
// If we found a matching file with a newer creation time, then
// save the user name. The newer creation time indicates that
// we found a newer incarnation of the process associated with
// vmid. Due to the way that Windows recycles pids and the fact
// that we can't delete the file from the file system namespace
// until last close, it is possible for there to be more than
// one hsperfdata file with a name matching vmid (diff users).
//
// We no longer ignore hsperfdata files where (st_size == 0).
// In this function, all we're trying to do is determine the
// name of the user that owns the process associated with vmid
// so the size doesn't matter. Very rarely, we have observed
// hsperfdata files where (st_size == 0) and the st_size field
// later becomes the expected value.
//
if
(
statbuf
.
st_ctime
>
latest_ctime
)
{
char
*
user
=
strchr
(
dentry
->
d_name
,
'_'
)
+
1
;
if
(
latest_user
!=
NULL
)
FREE_C_HEAP_ARRAY
(
char
,
latest_user
);
latest_user
=
NEW_C_HEAP_ARRAY
(
char
,
strlen
(
user
)
+
1
);
strcpy
(
latest_user
,
user
);
latest_ctime
=
statbuf
.
st_ctime
;
}
FREE_C_HEAP_ARRAY
(
char
,
filename
);
...
...
@@ -399,7 +410,7 @@ static char* get_user_name_slow(int vmid) {
os
::
closedir
(
tmpdirp
);
FREE_C_HEAP_ARRAY
(
char
,
tdbuf
);
return
(
old
est_user
);
return
(
lat
est_user
);
}
// return the name of the user that owns the process identified by vmid.
...
...
@@ -1339,6 +1350,38 @@ static HANDLE create_sharedmem_resources(const char* dirname, const char* filena
CloseHandle
(
fh
);
fh
=
NULL
;
return
NULL
;
}
else
{
// We created the file mapping, but rarely the size of the
// backing store file is reported as zero (0) which can cause
// failures when trying to use the hsperfdata file.
struct
stat
statbuf
;
int
ret_code
=
::
stat
(
filename
,
&
statbuf
);
if
(
ret_code
==
OS_ERR
)
{
if
(
PrintMiscellaneous
&&
Verbose
)
{
warning
(
"Could not get status information from file %s: %s
\n
"
,
filename
,
strerror
(
errno
));
}
CloseHandle
(
fmh
);
CloseHandle
(
fh
);
fh
=
NULL
;
fmh
=
NULL
;
return
NULL
;
}
// We could always call FlushFileBuffers() but the Microsoft
// docs indicate that it is considered expensive so we only
// call it when we observe the size as zero (0).
if
(
statbuf
.
st_size
==
0
&&
FlushFileBuffers
(
fh
)
!=
TRUE
)
{
DWORD
lasterror
=
GetLastError
();
if
(
PrintMiscellaneous
&&
Verbose
)
{
warning
(
"could not flush file %s: %d
\n
"
,
filename
,
lasterror
);
}
CloseHandle
(
fmh
);
CloseHandle
(
fh
);
fh
=
NULL
;
fmh
=
NULL
;
return
NULL
;
}
}
// the file has been successfully created and the file mapping
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录