The following command shows the number of performance cores and efficiency cores and the CPU type:
sysctl -a|egrep 'brand_string|(perflevel.*(physicalcpu:|name))'
On my MacBook Pro M1 this gives the following output:
hw.perflevel0.physicalcpu: 8
hw.perflevel0.name: Performance
hw.perflevel1.physicalcpu: 2
hw.perflevel1.name: Efficiency
machdep.cpu.brand_string: Apple M1 Pro
You can also enter this shorter command to get the caches sizes as well:
sysctl -a|grep perfl
On my MacBook Pro M1 this produces:
hw.perflevel0.physicalcpu: 8
hw.perflevel0.physicalcpu_max: 8
hw.perflevel0.logicalcpu: 8
hw.perflevel0.logicalcpu_max: 8
hw.perflevel0.l1icachesize: 196608
hw.perflevel0.l1dcachesize: 131072
hw.perflevel0.l2cachesize: 12582912
hw.perflevel0.cpusperl2: 4
hw.perflevel0.name: Performance
hw.perflevel1.physicalcpu: 2
hw.perflevel1.physicalcpu_max: 2
hw.perflevel1.logicalcpu: 2
hw.perflevel1.logicalcpu_max: 2
hw.perflevel1.l1icachesize: 131072
hw.perflevel1.l1dcachesize: 65536
hw.perflevel1.l2cachesize: 4194304
hw.perflevel1.cpusperl2: 2
hw.perflevel1.name: Efficiency
hw.nperflevels: 2