[완료] 캐쉬 라인(cache line) 의 크기를 알려면...?

dkvp21의 이미지

안녕하세요~ ^^

리눅스에서 캐쉬라인의 크기를 알고 싶습니다.

/proc/cpuinfo 에서 캐시크기는 나오는데...이거 L2 캐시죠?

L1의 크기를 알수는 없나요?

그리고 cache 가 한번에 얼만큼 올라가는지...캐쉬 라인의 크기도 알고 싶어요...ㅠㅠ

data locality 에 대해 코딩 좀 해볼려고 하는데...

정확한 캐쉬 정보를 몰라서 헤매고 잇습니다...;

그럼 답변 부탁드려요~

수고하세요~ ^^

익명 사용자의 이미지

그냥 상식수준에서 얘기해봅니다.

일단 CPU ID읽는 방법을 CPU제조업체에서 제공하는 매뉴얼대로 구현해서 ID을 얻어오면 Datasheet토대로 캐시라인을 알아낼수 있을거 같은데요.

익명 사용자의 이미지

상식수준에서 대답해보면

일단 CPU ID를 제조업체에서 제공하는 매뉴얼에 나와있는대로 읽어오고 그걸 토대로 datasheet에서 캐시라인크기를 확인하면 될거 같네요

익명 사용자의 이미지

상식수준에서 대답해보면

일단 CPU ID를 제조업체에서 제공하는 매뉴얼에 나와있는대로 읽어오고 그걸 토대로 datasheet에서 캐시라인크기를 확인하면 될거 같네요

dkvp21의 이미지

움...

제가 검색을 잘 못하는건지... 그 내용까지 나오는 매뉴얼을 못 찾았습니다...흑...

----------
I wanna know you~!

----------
I wanna know you~!

wariua의 이미지

웬간한 최근 시스템에는 sysfs가 마운트 돼 있을 겁니다. 그렇다면 /sys/devices/system/cpu 아래에서 CPU 정보를 좀 얻으실 수 있습니다.

$ cat /sys/devices/system/cpu/cpu0/cache/index0/{type,level,size,coherency_line_size}
Data
1
64K
64

----
$PWD `date`

$PWD `date`

익명 사용자의 이미지

cpu id읽는 방법은 ....

google에서 cpu id라고 치니 3번째 항목에 좋은내용이 보이네요

http://grafi.ii.pw.edu.pl/gbm/x86/cpuid.html

인용해보자면

Obtaining CPUID info
CPUID instruction opcode is 0fh, 0a2h (two bytes). An argument is passed in EAX. The argument selects information that should be returned by CPUID.

익명 사용자의 이미지

cpu id읽는 방법은 ....

google에서 cpu id라고 치니 3번째 항목에 좋은내용이 보이네요

http://grafi.ii.pw.edu.pl/gbm/x86/cpuid.html

인용해보자면

Obtaining CPUID info
CPUID instruction opcode is 0fh, 0a2h (two bytes). An argument is passed in EAX. The argument selects information that should be returned by CPUID.

dkvp21의 이미지

감사합니다~

----------
I wanna know you~!

----------
I wanna know you~!

Necromancer의 이미지

CPUID는 어셈블리 명령어입니다.
inline asm으로 사용하셔야 하고요.

그리고 CPUID명령은 486중 일부와 펜티엄급부터 제공됩니다.
(CPUID 지원여부를 알려주는 정보는 EFLAGS에 있습니다. 아마 bit 21번인가 22번인가일겁니다)

인텔 프로세서 매뉴얼 중 Instruction Set 매뉴얼을 찾아보시기 바랍니다.
http://www.intel.com/products/processor/manuals/index.htm

Written By the Black Knight of Destruction

Written By the Black Knight of Destruction

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.