লিনাক্সে এল 1, এল 2, এল 3 ক্যাশে এবং র‌্যামের আকার জানার কোনও উপায় আছে কি?


21

লিনাক্সে এল 1, এল 2, এল 3 ক্যাচ এবং র‌্যামের আকার জানার কোনও উপায় আছে কি?


ক্রস পোস্ট পোস্ট হয়েছে: superuser.com/q/837970
— maxschlepzig

উত্তর:


23

আপনি lshwইনস্টল করা থাকলে:

$ sudo lshw -C memory

উদাহরণ

$ sudo lshw -C memory
...
  *-cache:0
       description: L1 cache
       physical id: a
       slot: Internal L1 Cache
       size: 32KiB
       capacity: 32KiB
       capabilities: asynchronous internal write-through data
  *-cache:1
       description: L2 cache
       physical id: b
       slot: Internal L2 Cache
       size: 256KiB
       capacity: 256KiB
       capabilities: burst internal write-through unified
  *-cache:2
       description: L3 cache
       physical id: c
       slot: Internal L3 Cache
       size: 3MiB
       capacity: 8MiB
       capabilities: burst internal write-back
  *-memory
       description: System Memory
       physical id: 2a
       slot: System board or motherboard
       size: 8GiB
     *-bank:0
          description: SODIMM DDR3 Synchronous 1334 MHz (0.7 ns)
          product: M471B5273CH0-CH9
          vendor: Samsung
          physical id: 0
          serial: 67010644
          slot: DIMM 1
          size: 4GiB
          width: 64 bits
          clock: 1334MHz (0.7ns)
     *-bank:1
          description: SODIMM DDR3 Synchronous 1334 MHz (0.7 ns)
          product: 16JTF51264HZ-1G4H1
          vendor: Micron Technology
          physical id: 1
          serial: 3749C127
          slot: DIMM 2
          size: 4GiB
          width: 64 bits
          clock: 1334MHz (0.7ns)

1
উত্তরের পদার্থ অন্তর্ভুক্ত করুন। কেবল কমান্ডের নাম উল্লেখ করবেন না, তবে তাদের আউটপুট দেখান।
— slm

lshw(অবশ্যই রুট অনুমতি দিয়ে দৌড়ে) আমাকে ক্যাশের তথ্য দেয়নি। কিন্তু lscpuএবং dmidecodeসরঞ্জামগুলি আমাকে ফলাফল দিয়েছে।
— Shnd

19

lscpu

যদি আপনি কেবল আকারগুলি সম্পর্কে যত্নশীল হন তবে এ lscpuথেকে চেষ্টা করুন util-linux।

উদাহরণ

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 37
Model name:            Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz
Stepping:              5
CPU MHz:               1199.000
BogoMIPS:              5319.88
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3

x86info

X86info নামে প্যাকেজ / কমান্ড থাকা উচিত। ধরে নিলাম আপনার কাছে আই 386 / x86_64 রয়েছে, x86info -cক্যাশে সম্পর্কে আরও বিশদ তথ্য সরবরাহ করা উচিত।

উদাহরণ

$ x86info -c
x86info v1.30.  Dave Jones 2001-2011
Feedback to <davej@redhat.com>.

Found 4 identical CPUs
Extended Family: 0 Extended Model: 2 Family: 6 Model: 37 Stepping: 5
Type: 0 (Original OEM)
CPU Model (x86info's best guess): Core i7 (Nehalem) [Clarkdale/Arrandale]
Processor name string (BIOS programmed): Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz

Cache info
 L1 Instruction cache: 32KB, 4-way associative. 64 byte line size.
 L1 Data cache: 32KB, 8-way associative. 64 byte line size.
 L2 (MLC): 256KB, 8-way associative. 64 byte line size.
TLB info
 Instruction TLB: 2MB or 4MB pages, fully associative, 7 entries
 Instruction TLB: 4K pages, 4-way associative, 64 entries.
 Data TLB: 4KB or 4MB pages, fully associative, 32 entries.
 Data TLB: 4KB pages, 4-way associative, 64 entries
 Data TLB: 4K pages, 4-way associative, 512 entries.
 Data TLB: 4KB or 4MB pages, fully associative, 32 entries.
 Data TLB: 4KB pages, 4-way associative, 64 entries
 64 byte prefetching.
 Data TLB: 4K pages, 4-way associative, 512 entries.
Found unknown cache descriptors: dd 
Total processor threads: 4
This system has 1 dual-core processor with hyper-threading (2 threads per core) running at an estimated 2.65GHz

3

আপনি এই আদেশটি চেষ্টা করতে পারেন।

$sudo dmidecode -t cache

উদাহরণ

$ sudo dmidecode -t cache | grep -iE "leve|installed"
    Configuration: Enabled, Socketed, Level 1
    Installed Size: 32 kB
    Installed SRAM Type: Asynchronous
    Configuration: Enabled, Socketed, Level 2
    Installed Size: 256 kB
    Installed SRAM Type: Burst
    Configuration: Enabled, Socketed, Level 3
    Installed Size: 3072 kB
    Installed SRAM Type: Burst

র‌্যামটি দেখতে কেবল অতিরিক্ত স্যুইচ যুক্ত করুন -t memory।

$ sudo dmidecode -t cache -t memory

তথ্যসূত্র


3

getconf

getconf -a | grep CACHE

দেয়:

LEVEL1_ICACHE_SIZE                 32768
LEVEL1_ICACHE_ASSOC                8
LEVEL1_ICACHE_LINESIZE             64
LEVEL1_DCACHE_SIZE                 32768
LEVEL1_DCACHE_ASSOC                8
LEVEL1_DCACHE_LINESIZE             64
LEVEL2_CACHE_SIZE                  262144
LEVEL2_CACHE_ASSOC                 8
LEVEL2_CACHE_LINESIZE              64
LEVEL3_CACHE_SIZE                  20971520
LEVEL3_CACHE_ASSOC                 20
LEVEL3_CACHE_LINESIZE              64
LEVEL4_CACHE_SIZE                  0
LEVEL4_CACHE_ASSOC                 0
LEVEL4_CACHE_LINESIZE              0

বা একক স্তরের জন্য:

getconf LEVEL2_CACHE_SIZE

এই ইন্টারফেসটি সম্পর্কে দুর্দান্ত জিনিসটি হ'ল এটি পসিক্স sysconfসি ফাংশনটির চারপাশে কেবল একটি মোড়ক (ক্যাশে আর্গুমেন্টগুলি নন-পসিক্স এক্সটেনশনগুলি) এবং তাই এটি সি কোড থেকেও ব্যবহার করা যেতে পারে।

উবুন্টু 16.04 এ পরীক্ষিত।

x86 সিপিইউডির নির্দেশনা

সিপিইউডিএক্স x86 নির্দেশে ক্যাশে সম্পর্কিত তথ্যও সরবরাহ করা হয় এবং এটি ব্যবহারকারীর মাধ্যমে সরাসরি অ্যাক্সেস করা যায়: https://en.wikedia.org/wiki/CPUID

glibc x86- এর জন্য এই পদ্ধতিটি ব্যবহার করছে বলে মনে হচ্ছে। পদক্ষেপ ডিবাগিং / নির্দেশের ট্রেসিং দ্বারা আমি নিশ্চিত করেছিলাম না, তবে ২.২৮ এর উত্সটি sysdeps/x86/cacheinfo.cতা করে:

__cpuid (2, eax, ebx, ecx, edx);

টুডো এখন একটি স্বল্প ন্যূনতম সি উদাহরণ তৈরি করুন, এখানে জিজ্ঞাসা করা হয়েছে: /programming/

ক্যাশ সাইজ আইডি রেজিস্টার (সিসিএসআইডিআর) এর মতো রেজিস্টারগুলির মাধ্যমে ক্যাশে আকারগুলি খুঁজে পাওয়ার জন্য এআরএমের একটি আর্কিটেকচার-সংজ্ঞায়িত প্রক্রিয়াও রয়েছে, একটি সংক্ষিপ্তসার জন্য এআরএমভি 8 প্রোগ্রামারগুলির ম্যানুয়াল 11.6 "ক্যাশে আবিষ্কার" দেখুন।


2

sysfsলিনাক্স ফাইল সিস্টেমে ২০০ 2008 সাল থেকে রফতানি করা বিশেষ ফাইল রয়েছে :

https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu

What:       /sys/devices/system/cpu/cpu*/cache/index*/<set_of_attributes_mentioned_below>
Date:       July 2014(documented, existed before August 2008)
Description:    Parameters for the CPU cache attributes

    allocation_policy:
        - WriteAllocate: allocate a memory location to a cache line
                 on a cache miss because of a write
        - ReadAllocate: allocate a memory location to a cache line
                on a cache miss because of a read
        - ReadWriteAllocate: both writeallocate and readallocate

    coherency_line_size: the minimum amount of data in bytes that gets
                 transferred from memory to cache

    level: the cache hierarchy in the multi-level cache configuration

    number_of_sets: total number of sets in the cache, a set is a
            collection of cache lines with the same cache index

    physical_line_partition: number of physical cache line per cache tag

    shared_cpu_list: the list of logical cpus sharing the cache

    shared_cpu_map: logical cpu mask containing the list of cpus sharing
            the cache

    size: the total cache size in kB

    type:
        - Instruction: cache that only holds instructions
        - Data: cache that only caches data
        - Unified: cache that holds both data and instructions

    ways_of_associativity: degree of freedom in placing a particular block
                of memory in the cache

    write_policy:
        - WriteThrough: data is written to both the cache line
                and to the block in the lower-level memory
        - WriteBack: data is written only to the cache line and
                 the modified cache line is written to main
                 memory only when it is replaced

আইডি ফাইলগুলি:

What:       /sys/devices/system/cpu/cpu*/cache/index*/id
Date:       September 2016
Contact:    Linux kernel mailing list <linux-kernel@vger.kernel.org>
Description:    Cache id

    The id provides a unique number for a specific instance of
    a cache of a particular type. E.g. there may be a level
    3 unified cache on each socket in a server and we may
    assign them ids 0, 1, 2, ...

    Note that id value can be non-contiguous. E.g. level 1
    caches typically exist per core, but there may not be a
    power of two cores on a socket, so these caches may be
    numbered 0, 1, 2, 3, 4, 5, 8, 9, 10, ...

আমার মেশিনে index0এবং index1দু'জনেই level 1কার্নেল v4.15 এ কেন করণীয় তা আমি বিস্ময়কর । 0-সূচক প্রতিরোধক কোডিং? :-)
— সিরো সান্তিলি 新疆 改造 中心 法轮功 六四 事件

1
@ সিরোস্যান্টিলি 涌 涌 低端 人口 六四 事件 法轮功, (নামটি উচ্চারণ না করার সাথে), সম্ভবত typeইনডেক্স 0 ডেটা (এল 1 ডেটা ক্যাশে) এর সাথে প্রায় এল 1 এবং typeনির্দেশিকা (এল 1 নির্দেশিকা ক্যাশে) এর সাথে প্রায় এল 1 রয়েছে 1 তারপরে ইনডেক্স 2 type ইউনিফাইডের এবং level2
— টির

অই হ্যাঁ! ডক্স পড়ার জন্য আমার আরও ধৈর্য হওয়া উচিত :-)
— সিওরো সান্তিলি 事件 改造 中心 法轮功 六四 事件

1

cpuid

আর একটি বিকল্প সিপিইড প্রোগ্রাম id এটি CPUIDনির্দেশাবলী ব্যবহার করে এবং মূলের প্রয়োজন হয় না। এটি cpuidলিনাক্স কার্নেল মডিউল মাধ্যমে কাজ করতে পারে ।

cache and TLB information (2):
   0x59: data TLB: 4K pages, 16 entries
   0xba: data TLB: 4K pages, 4-way, 64 entries
   0x4f: instruction TLB: 4K pages, 32 entries
   0xc0: data TLB: 4K & 4M pages, 4-way, 8 entries
   0x80: L2 cache: 512K, 8-way, 64 byte lines
   0x30: L1 cache: 32K, 8-way, 64 byte lines
   0x0e: L1 data cache: 24K, 6-way, 64 byte lines

নোট করুন যে সাধারণ গ্রাহক সিপিইউগুলিতে এল 1 এবং এল 2 ক্যাশে প্রতি কোর হয়, এবং এল 3 ক্যাশে সমস্ত কোর দ্বারা ভাগ করা হয়।


0

আপনি যদি কেবল এল 3 চান তবে grep "cache size" < /proc/cpuinfoযথেষ্ট হওয়া উচিত।

তবে যেহেতু সিপিইউ খিলানের মধ্যে এল 3 ক্যাশে ভাগ করে নেওয়া হয়েছে তাই এর মানটির স্বাভাবিককরণের প্রয়োজন হতে পারে


সম্ভবত আপনি বিড়ালের অপ্রয়োজনীয় ব্যবহার মুছে ফেলতে চান।
— ম্যাক্সচলেপজিগ
আমাদের সাইট ব্যবহার করে, আপনি স্বীকার করেছেন যে আপনি আমাদের কুকি নীতি এবং গোপনীয়তা নীতিটি পড়েছেন এবং বুঝতে পেরেছেন ।
Licensed under cc by-sa 3.0 with attribution required.